Hi there.
I’m trying to fetch valid custom field values for a custom field with type/schema com.atlassian.jira.plugins.cmdb:cmdb-object-cftype (as indicated by the “create meta” api). The response also gives me an autocomplete url for the field. However, whereas most fields’ autocomplete urls are pointed to api.atlassian.net, this one is not and is pointed to our atlassian domain. Further, using our apps oauth bearer token yields a variety of errors depending on how specifically the request is made. The url is of the form https://<our atlassian doamin>/rest/servicedesk/cmdb/<an id>/field/customfield_<field id>/config/<some other id>/autocomplete?.
What is the proper way to fetch valid values for this field via an api? How does such a request need to be authenticated?
Any help or hints that anybody has would be appreciated.
2 Likes
Hi @FireHydrantEng
there is no proper & easy way.
For autocomplete you need to provide the issueId (as context) in the body search payload, so it’s practically only useful from an issue perspective. I believe “an id” is the serviceDeskId and “some other id” is the context id of the field. As auth just provide a valid token in the Authorization header to make it work.
When you have no issue context, you need a workaround e.g. query the asset field context /rest/api/3/field/${fieldId}/context and use the context id from there against the internal field config endpoint /rest/servicedesk/cmdb/latest/fieldconfig/${fieldContextId} to fetch the details to build your autocomplete yourself - use objectSchemaId, objectFilterQuery and attributesIncludedInAutoCompleteSearch to build the autocomplete aql against /jsm/assets/workspace/${workspaceId}/v1/object/aql.
Hope it explains.
Samuel
2 Likes