Forums

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

How to get body data from a client request with REST API?

António José Figueiredo July 6, 2018

So my problem is, i have 2 instances of jira in diferent locations and i want to request a service, via Jira REST Api, from one of the instances to the other. At the service, that is on Jira v7.2.12, i need to get the body content from the request but the question is how?

How can i do it with Jira REST Api? Is it possible to do it?

Regards.

1 answer

0 votes
MoroSystems Support
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2018

Hello António,

I am not completely sure I understand your question. If you want to call REST API of Jira instance, it doesn't matter whether you are calling it from another Jira or some app on your computer. You will have to authorize the request the same way (e.g. through Basic Auth).

If you are interested in a way how to do it (how to call API) - it generally depends on your use case. You can either write yourself one-time script to be executed e.g. from ScriptRunner plugin or you can write yourself a plugin which will make use of some REST Client as Unirest or Apache HTTP Client.

Regards,
Martin

António José Figueiredo July 11, 2018

Hi Martin,

I was able to solve my problem, passing to @Consumes annotation on the method, the MediaType.APPLICATION_FORM_URLENCODED attribute, and on the method parameters, the @FormParam annotation from JAX-RS with the string name that is associated to the request body from the client.

Was a problem of not knowing what was the mediatype that the client was passing throw the request body.

Thanks for the response anyway .

Regards,

António

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events