Looking for an API to query for asset object details

I have a request in JSM which has an asset custom field linked to it. I’m looking for an API endpoint that will allow me to query for said asset object by Id and provide back the details (name in particular for my use case).

I’ve tried both of the following endpoints:

GET /rest/servicedeskapi/request/{issueIdOrKey}

GET /rest/api/3/issue/{issueIdOrKey}

Both provide me the custom field containing my asset in the following format:

{
    "workspaceId": "c1d2d489-698a-49fd-9f95-14ccb2c89f3a",
    "id": "c1d2d489-698a-49fd-9f95-14ccb2c89f3a:1",
    "objectId": "1"
}

What I can’t seem to find is an API which will allow me to pass the above workspaceId and/or objectId in order to get the actual object details. Any assistance is appreciated.

1 Like

*bump*

Any insight on this one? It seems the details of the asset record should be available via some API, but as @jvillanuevabeyondtru alluded, there doesn’t seem to be one listed in any of the documentation I’ve reviewed.

Insight is Assets now

https://developer.atlassian.com/cloud/assets/rest

And is that REST API accessible from Connect apps (through JWT authentication)?

From your link, I’ve tried this endpoint:

GET /jsm/assets/workspace/{workspaceId}/v1/object/{id}

but am getting a 404 response. Presumably that wouldn’t be caused by an authentication failure so I’m not sure exactly what could be going wrong here. I’ve copied that endpoint link directly from the documentation (subbing in my own values of course).

Is it possible the endpoint was moved and the documentation not updated?

I’ve used these endpoints in a Forge app, where they are not supported (doesn’t authenticate automatically as with most other product resources).

I’ve had to use fetch and provided basic auth in headers (Email + API token) :

The base URL for these endpoints is “https://api.atlassian.com”.

https://id.atlassian.com/manage-profile/security/api-tokens

https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/#get-an-api-token

1 Like

Is that still not possible?

I was expecting to a list of seets … eg via

const fetchAssets = async (workspaceId) => {
  const asAppRequest = await api
        .asApp()
        .requestJira(
                route`/jsm/assets/workspace/${workspaceId}/v1/?????`,
                {
                   method: "POST",
                }
        );
};

@FabianWallwitz,

I responded on your cross-post with a link to the announcement blog:

Following the links from there, here’s an example call to the assets API:

  const asUserRequest = await api
        .asUser()
        .requestJira(
                route`/jsm/assets/workspace/${context.workspaceId}/v1/importsource/${context.importId}/executions`,
                {
                   method: "POST",
                }
        );

You’ll probably want to read the full guide to learn more.