You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many people have been asking how to do this so I thought I'd just post some sample code with a working solution. Could we sticky this, or at least update the main README? I got this working using https://parseapi.back4app.com as an API endpoint. They provide a solid Parse hosting solution. This is just a proof of concept in a single Java class. I'm sure it would be more useful in a Spring or Springboot application.
import org.parse4j.Parse;
import org.parse4j.ParseException;
import org.parse4j.ParseObject;
import org.parse4j.ParseQuery;
import org.parse4j.callback.GetCallback;
/**
* Created by Martin on 3/27/2017.
*/
public class Parse4JStarter {
public static void main(String[] args) {
Parse.initialize("applicationId","restAPIKey", "https://parseapi.back4app.com");
if (Parse.getApplicationId() != null) {
System.out.println("ParseConnection successful! " + Parse.getApplicationId());
try {
queryPost();
} catch (ParseException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static void queryPost() throws Exception {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Post");
query.getInBackground("4tD9TIIIhv", new GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (e == null) {
System.out.println("ParseObject printed successfully! " + object);
} else {
e.printStackTrace();
}
}
});
}
}
Make sure your dependency includes the latest snapshot build, 1.5-SNAPSHOT. I also included some logging dependencies because my console told me to include them for some reason:
Hi @santafebound !
Thanks for the sample code. A quick question: since parse4j 1.5-SNAPSHOT does not seem to exist in any public repo, do we have to build the jar locally and put it in the local maven repo ourselves?
Thanks
Allen
Many people have been asking how to do this so I thought I'd just post some sample code with a working solution. Could we sticky this, or at least update the main README? I got this working using https://parseapi.back4app.com as an API endpoint. They provide a solid Parse hosting solution. This is just a proof of concept in a single Java class. I'm sure it would be more useful in a Spring or Springboot application.
Make sure your dependency includes the latest snapshot build, 1.5-SNAPSHOT. I also included some logging dependencies because my console told me to include them for some reason:
The text was updated successfully, but these errors were encountered: