Jira API with CURL throws error {"errorMessages":["The value 'XXX' does not exist for the field 'project'."],"errors":{}}

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

There is an issue with REST API using CURL

  • When running the REST URL using the browser , the JSON response is OK
  • When running the REST URL using CURL with PHP, user receives the following error : 
 
{"errorMessages":["The value 'XXX' does not exist for the field 'project'."],"errors":{}}

Cause

This error can be thrown when the API call is being made without proper authentication and/or authorization.  The Jira REST API does allow anonymous access for some endpoints, so when a call is made without authentication, the system can reply in this manner to avoid leaking details to unauthenticated requests. An authenticated, and authorized user session needs to be created first. 

Resolution

Create a session as per Security overview.  One way would be to use Basic authentication or use the JSESSIONID in the request header.

Last modified on Jun 6, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.