Issues with Jira API /search endpoint: fields not available for anonymous users

I’m encountering a problem with a REST API call that ran smoothly on my self-hosted Jira instance, but fails on atlassian.net. Here’s my request:

POST /rest/api/2/search

with this body:

{
    "jql": "worklogAuthor = currentUser() AND worklogDate = 2022-09-30 ORDER BY updated ASC",
    "fields": [
        "worklog"
    ]
}

The error message returned is:

{
    "errorMessages": [
        "Field 'worklogAuthor' does not exist or this field cannot be viewed by anonymous users.",
        "Field 'worklogDate' does not exist or this field cannot be viewed by anonymous users."
    ],
    "warningMessages": []
}

Previously, I accessed my self-hosted Jira using a username and password, but on atlassian.net, I generated an API token instead of using my password.

Hey CreativeArtist88, since you're facing issues with field visibility on Jira Cloud, try these steps:

  • API Token Permissions: Confirm the API token is linked to a user with access to the required fields.
  • Field Existence: Check if 'worklogAuthor' and 'worklogDate' exist in your Jira Cloud instance—these fields might differ from your self-hosted setup.
  • User Authentication: Ensure that your token is not causing the user to be flagged as 'anonymous'.

Adjust these settings, and your issue should be resolved.

The issue you're experiencing with the Jira Cloud API is related to permissions and the way field visibility is managed within atlassian.net compared to a self-hosted environment. The message indicates that the fields you are trying to access ('worklogAuthor', 'worklogDate') either do not exist in your current configuration or cannot be accessed by anonymous users.

Here are a few steps to resolve this:

  • Check Permissions: Ensure that the API token you generated has the proper permissions. Make sure it's associated with a user who has the necessary permissions to view the fields in questions. In Jira Cloud, permissions and field visibility can be more restricted compared to a self-hosted setup.
  • <li><strong>Field Configuration:</strong> Verify whether the fields 'worklogAuthor' and 'worklogDate' exist in your Jira Cloud project. It's possible that these fields might be custom fields in your self-hosted instance and may not exist in the cloud environment.</li>
    
    <li><strong>Authentication:</strong> Since you are using an API token instead of a password on atlassian.net, double-check that the token is correctly linked to a user with sufficient permissions and that the user is not considered 'anonymous' by the system.</li>
    
    <li><strong>JQL Limitations:</strong> The JQL query you are using may be restricted by your cloud instance's settings. Jira Cloud may have different configurations and restrictions on JQL queries.</li>
    

In case the above-mentioned steps don't resolve the issue, consider checking the Jira Cloud's REST API documentation for any recent changes or updates to the fields you are accessing.