Protected Fields can be read/edited via API.

Go to Manage Apps → Protected Fields

Click the API tab.

To enable API access you need to generate an access token.

Click the Generate Access Token - button to generate one or more tokens.

By default the access token will be applicable for all projects with Read and Write permissions.

Click the Edit link to edit token permissions

Get Protected Field values via API

Make a HTTP GET request to the URL available on your API page.

Required parameters:

token = the access token (scope must be READ and projects must match issue project)

issueKey = the issue to read protected field values from

fieldId = id of field to read value from

Note: add multiple fieldId parameters to receive multiple fields in one request.

Response:

200 OK (application/json) When request is valid

Body:

[
    {
      "fieldId":"customfield_10121",
      "value": value in readable format 
    }, 
    {
      "fieldId":"customfield_10122",
      "value": value in readable format 
    }
  ]

400 BAD REQUEST When request is invald

Body:

Error message

Note: Verify parameters to resolve this issue

401 UNAUTHORIZED When request is unauthorized.

Body:

Error message

Note: Verify access token permissions to resolve this issue

Store Protected Field values via API

Make a HTTP PUT (or POST) request to the URL available on your API page.

Required parameters:

token = the access token (scope must be WRITE and projects must match issue project)

issueKey = the issue to read protected field values from

Required post body:

An array of field entities, use multiple entities to update multiple field values. Note: To update a single value this still has to be an array containing the single value entity.

[
    {
      "fieldId":"customfield_10121",
      "value" Object value in readable format (string, number, date on format "yyyy-MM-dd")
    }, 
    {
      "fieldId":"customfield_10122",
      "value" Object value in readable format 
    }
  ]

Response:

200 OK When request is valid and value was updated

Body: OK

400 BAD REQUEST When request is invalid

Body:Bad Request

Note: Verify parameters to resolve this issue

401 UNAUTHORIZED When request is unauthorized.

Body: Unauthorized

Note: Verify access token permissions to resolve this issue

401 BAD REQUEST When request is unauthorized.

Body:Bad Request

Note: Make sure the that the project(s) has Edit Permission: atlassian-addons-project-access

Check that the Field exists on the edit screen.

Field Formats

Users

Encrypted User Field

{
    "fieldId": "customfield_10122",
    "value": "{{accountId}}"
}

Unencrypted User Field

{
    "fieldId": "customfield_10122",
    "value": { 
      "accountId": "{{accountId}}"
    }
}

Multi-User picker

Encrypted Multi User Field

{
    "fieldId": "customfield_10122",
    "value": ["{{accountId-1}}", "{{accountId-2}}"]
}

Unencrypted Multi User Field

{
    "fieldId": "customfield_10122",
    "value": ["{{accountId-1}}", "{{accountId-2}}"]
}

Group field

Encrypted Group Field

{
    "fieldId": "customfield_10122",
    "value": {
      "groups": ["{{groupName-1}}", "{{groupName-2}}"]
    }
}

Unencrypted Group Field

{
    "fieldId": "customfield_10122",
    "value": {
      "groups": ["{{groupName-1}}", "{{groupName-2}}"]
    }
}

Collection Field

Encrypted Collection Field

{
    "fieldId": "customfield_10122",
    "value": ["{{value-1}}", "{{value-2}}"]
    }
}

Unencrypted Collection Field

{
    "fieldId": "customfield_10122",
    "value": {
      "groups": ["{{groupName-1}}", "{{groupName-2}}"]
    }
}

Number Field

Encrypted Number Field

{
    "fieldId": "customfield_10122",
    "value": {{number}}
    }
}

Unencrypted Number Field

{
    "fieldId": "customfield_10122",
    "value": {{number}}
}

Text Field

Encrypted Text Field

{
    "fieldId": "customfield_10122",
    "value": "{{text}}"
    }
}

Unencrypted Text Field

{
    "fieldId": "customfield_10122",
    "value": "{{text}}"
}