Forums

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

What's the correct ID to use for /rest/api/3/customFieldOption/<field_id>?

Shawn Oster
Contributor
November 3, 2023

I'm attempting to a list of all allowed values for a custom-single select field using the v3 API and frankly, it's making me lose my ever-loving mind.

1. Fetch ID of custom field

```

/rest/api/latest/field

```

 

2. Inspect response for ID

```json

{
"id": "customfield_10252",
"key": "customfield_10252",
"name": "Employer Partner",
"untranslatedName": "Employer Partner",
"custom": true,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"cf[10252]",
"Employer Partner",
"Employer Partner[Dropdown]"
],
"schema": {
"type": "option",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
"customId": 10252
}
},

```

 

3. Pass ID (`10252`) to `customFieldOption` end-point

```

/rest/api/3/customFieldOption/10252

```

 

4. Get back different (wrong) field

```json

{
"self": "/rest/api/3/customFieldOption/10252",
"value": "BAU (ongoing support, maintaining operations)"
}

```

 

BAU isn't even one of the dropdown/single-select options. Obviously, I'm doing something wrong, any pointers?

_FYI I'm aware I can use the editmeta end-point (`/rest/api/3/issue/GR-1/editmeta`) but that requires a known ticket ID and it brings back a much larger payload._

1 answer

1 accepted

0 votes
Answer accepted
Shawn Oster
Contributor
November 3, 2023

Of course the second I post I find out my issue. I was using the wrong end-point for select lists, use this instead:

```

/rest/api/3/field/customfield_10252/context/10487/option

```

1. field ID is the full name (with customfield_)

2. Screen context ID I pulled from the "Edit Context" URL

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events