[feature]: Add work item custom properties to /work-items/ API response
Is there an existing issue for this?
- [x] I have searched the existing issues
Summary
I have created some custom work item properties so that I can leverage them via some automated processes. However, I've just discovered the number of steps it takes with different API endpoints just to retrieve a single custom property value.
If I have this wrong and there's a better way to do it, I'm all ears
- Call list all work items API
- For each work item, use the work item type Id to call the List custom properties endpoint
- For each custom property, call the custom property values endpoint to retrieve the value
So let's say for example I have a work item type with 2 custom properties. That means if I want to retrieve the "standard" properties as well as the custom ones for a single work item, I have to make 4 separate API calls to retrieve that value
- GET /work-items
- GET /work-item-types/{type_id}/work-item-properties
- GET /work-item-properties/{property_id_1}/values
- GET /work-item-properties/{property_id_2}/values
Can there not just be a "custom_properties" object array that is attached to the response when you call GET /work-items ? That seems to be far more efficient
Why should this be worked on?
If you want more people to utilize custom properties you need to make them easier to programmatically retrieve
Hi @iamcheek Appreciate the suggestion. We’re evaluating the implementation and will keep this thread posted on progress.
I would also find this useful.
For the single-work-item case there is already a one-call answer, which doesn't seem to be documented: GET /work-items/{id}/properties/ returns the work item plus a custom_fields object, with each property's value already resolved.
"custom_fields": {
"target-environment": {
"id": "…",
"type": "OPTION",
"display_name": "Target Environment",
"is_multi": false,
"value": "…",
"value_detail": { "id": "…", "name": "PROD" }
}
}
That replaces the three property lookups: no fetching the type's properties, no per-property values call, and for OPTION types no second lookup to turn the option id into a name.
The list case is still the gap this issue describes. GET /work-items/ returns no custom_fields, so reading one property across N work items is N calls. Having the list response return the same shape /properties/ already does would close it.
Worth noting the two responses disagree in other ways too, which is its own problem for anyone switching between them: /properties/ gives state_id, assignee_ids and label_ids, while /work-items/{id}/ gives expanded state and labels objects. Related: #9534, #9594.
Hi @vihar @pushya22,
I'd like to contribute to this issue.
Proposed implementation approach:
- Trace the existing
GET /work-items/endpoint andGET /work-items/{id}/properties/endpoint to understand how custom field values are resolved. - Reuse the existing custom field resolution logic where possible, instead of introducing duplicate logic.
- Update the work items list response to include a
custom_fieldsobject consistent with the existing properties endpoint, while keeping the response backward-compatible. - Make sure the implementation handles work items with no custom fields and different custom property types correctly.
Verification plan:
- Add tests to verify that the list response includes the correct custom field values.
- Test work items with multiple custom fields, missing values, and no custom fields.
- Check that pagination, filtering, and existing API behavior continue to work.
- Check for unnecessary database queries when returning multiple work items, to avoid introducing N+1 query or performance issues.
- Run the relevant API tests and required linting checks.
Before starting implementation, could you please confirm whether this feature is still planned and whether this approach aligns with the team's expectations? I'd also appreciate any guidance on the expected response structure or performance constraints.
Thanks!