# OAuth with Java

**URL:** <https://integration.keap.com/t/oauth-with-java/24420>\
**Category:** API Q&A\
**Created:** [December 14, 2017, 11:45pm UTC](https://integration.keap.com/t/oauth-with-java/24420 "2017-12-14T23:45:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Gorrell](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@Aaron\_Gorrell](https://integration.keap.com/u/Aaron_Gorrell)\
**Post date:** [December 14, 2017, 11:45pm UTC](https://integration.keap.com/t/oauth-with-java/24420/1 "2017-12-14T23:45:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [December 15, 2017, 1:51pm UTC](https://integration.keap.com/t/oauth-with-java/24420/2 "2017-12-15T13:51:17Z")

</div>

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:

[![](https://us1.discourse-cdn.com/flex019/uploads/infusionsoft1/original/2X/6/636d9b0c40071bb3385c3bbf0995d6c5fd9b1be5.jpeg "Using OAuth2 and Infusionsoft API/REST") ](https://www.youtube.com/watch?v=zjS8tCmnkBs)

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]”)
.patch(body)
.addHeader(“content-type”, “application/json”)
.build();
`

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