REST API returns 403(forbidden) when sending body as JSON

Your documentation for REST API says that the api returns or consumes two types of formats: XML or JSON, and that corresponding headers should be used: Content-Type and Accept.
I was trying to create a new issue using PUT /rest/issue endpoint, so I set the Content-Type to application/json, but in response I got status 403 ("You do not have permissions to Create Issue, or project [null] does not exist.)

Did I get it wrong? So this particular endpoint does not support JSON input?

If I use query params, everything works fine and issue is created, but sometimes i get error 414 (URI too long), when the issue is longer. That is the reason I tried to send the body in JSON.

Can you suggest another workaround? 

 

6 comments
Comment actions Permalink
Official comment

Do you use the same user for JSON and XML requests? 

Comment actions Permalink

Yes, same account, but for both XML and JSON I get 403 and same message. It works only when query params are used. 

0
Comment actions Permalink

Could you please double-check JSON or check, that the project is mentioned there, because "project [null] does not exist" error message shows it.

0
Comment actions Permalink

JSON that I am sending looks like this:

{

"project": "<valid_project_id>",

"summary": "some summary",

"description": "some issue description"

}

I am assuming that in case of invalid body, I would receive a different response. But I've also tried to send all five properties, which this endpoint should consume: project, summary, description, attachments, permittedGroup. I wasn't able to tell, which properties are required and which ones are optional based on your documentation.

 

0
Comment actions Permalink

The project should not be recognized as [null], it means that you either don't have enough permissions, or the project id is not valid.

0

Please sign in to leave a comment.