Getting Assets reference types via API in Forge app

I’ve previously used API endpoints https://api.atlassian.com/jsm/assets/workspace/${workspaceId}/v1/global/config or https://api.atlassian.com/jsm/assets/workspace/${workspaceId}/v1/global/config/objectschema/${schemaId}
to get a list of reference types and their IDs when using a PAT token, but trying either endpoint from a Forge app (as either the app or a user) gives me a 401 - “Unauthorized; scope does not match”.

I have the following scopes in my manifest:
- read:servicedesk-request
- import:import-configuration:cmdb
- read:cmdb-object:jira
- write:cmdb-object:jira
- read:cmdb-schema:jira
- write:cmdb-schema:jira
- delete:cmdb-schema:jira
- read:cmdb-type:jira
- write:cmdb-type:jira
- read:cmdb-attribute:jira
- write:cmdb-attribute:jira
- read:cmdb-icon:jira

Is there a supported way to get this information? I don’t see any mention of reference types in the Assets API reference.

1 Like

Hi @AndyLyonette, do you have any API reference for this particular API? I don’t think that it’s supported for OAuth.
As for the Assets API reference you are referring to, is it this one: https://developer.atlassian.com/cloud/assets/rest?

Yes, that’s the API reference. If this endpoint isn’t supported, what is the supported way to programmatically get Assets reference types?

Hi @AndyLyonette, I spoke to the JSM team and unfortunately there isn’t an API that can be consumed by Forge apps at this point. If you really need to call this API, then the way to do so would be to do so in your Forge app by manually calling it with API token as authentication.

If this is an API that you need to call using the Forge asApp/asUser helpers, I would also recommend creating a feature request and voting on the ticket.

1 Like

Hi @BoZhang ,

Can you please confirm that you would need an API token for accessing the API, since https://ecosystem.atlassian.net/browse/FRGE-1131 talks about native integration… Can you clarify?

1 Like

Hi @ajay, yes, to access this particular API, you must use an API token. The team have moved most of their APIs to support OAuth (like here: https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-id-get). The particular API referenced here had not been moved as it was was not really intended for public use and was not published in our API docs.
I’ve spoken to the team about this and they are willing to support it if there is enough dev community interest in being able to access this particular API natively in Forge apps. Please do raise a feature request (I can’t find a ticket already existing for this) and vote on the ticket if this of interest to you.

Hi @BoZhang - I’ve created https://ecosystem.atlassian.net/browse/FRGE-1584

1 Like