Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Java application with OAuth to send REST requests

andrea schneider
Contributor
January 15, 2019

Hi

I would like to create a Java application that let's me do some stuff with REST requests using OAuth as authentication. The application will only be started within Eclipse. Is there anywhere such an example that really explains it all?

I was trying to follow this tutorial

https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-oauth-authentication-6291692

but it is completely outdated and the downloads are missing too. Can anyone please give me starting point how I can achieve what I need? I would use it for the latest Jira version 7.13.

Thanks a lot for your help

1 answer

1 accepted

0 votes
Answer accepted
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2019

Hello Andrea,

Thank you for bringing the documentation issue to our attention. I have created a support request to have the above document reviewed and all links validated to ensure we're providing helpful documentation.

I am working on getting an updated or relevant source so you may have at least a starting point for this. Please allow me some time to locate something for you.

Regards,
Stephen Sifers

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2019

Hello again Andrea,

I found the following which seems to be more up-to-date with OAuth. OAuth for REST APIs. Within that document there is a Bitbucket repo with updated examples that won't give you a 404 when you attempt to download: https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples

Please let us know if this is what you're looking for!

Regards,
Stephen Sifers

andrea schneider
Contributor
January 28, 2019

Hi Stephen

Sorry for the late response...

Thanks a lot for the links, I will try to get it working.

 

Best regards to Austin
Andrea

Like Stephen Sifers likes this
sriprasanna.mg
Contributor
November 6, 2020 edited

Hi Stephen,

Thanks a lot for the reference. Following the guide it was possible to make successful REST calls - GET with oauth. 

But we are now I am stuck with POST calls. Is there an example to do that?

I tried to extend the OAuthClient.Java with this method but always ends up in Error 405 - Method not allowed

image.png  

sriprasanna.mg
Contributor
November 9, 2020

Hi,

Problem is fixed!

Also make sure that the POST request body is specified correctly:

In my case I used VS Code for debugging - the double quotes are escaped properly only on using three backslashes \\\ 

Eg: 
"{\\\"globalId\\\"\\\"82411\\\",\\\"object\\\": {\\\"url\\\"\\\"http://google.com\\\",\\\"title\\\"\\\"This is a remote link\\\"}

}"

2020-11-09_10-15-11.png

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events