OAuth with Java

Does anyone have sample code they would be willing to share demonstrating connecting to Infusionsoft REST using OAuth and then subsequent calls?

All you need to know specific to Java is how to make external url calls. It would be more about understanding the workflow as making the call is the only part that is language specific regardless of using PHP, Python, Java…etc…

This vid covers most of what you will need. Just replace the call outs with the syntax for Java:

Also, you may want to look into an app called Postman. It will allow you to setup call outs and then will generate the code you need in a multitude of languages for you…an example is below:

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse(“application/json”);
RequestBody body = RequestBody.create(mediaType, “{"notes": "These are notes to live by"}”);
Request request = new Request.Builder()
.url(“https://api.infusionsoft.com/crm/rest/v1/contacts/123456?access_token=[access_key goes here]”)
.addHeader(“content-type”, “application/json”)

Response response = client.newCall(request).execute();