Make Asset REST API call from Forge App as User

I would like to make a REST API call to get assets from asset api as user. Would woud be the best way to do so?

Hi @SergeyEpifanov ,
Unfortunately, Forge does not support Assets Platform REST API because of Forge limitations.
We have two suggestion tickets about both Assets APIs.
Assets Platform [FRGE-1131] - Ecosystem Jira
Assets REST API [FRGE-1172] - Ecosystem Jira
Feel free to add your opinion there.
Best regards,
Damian

2 Likes

Good news @SergeyEpifanov,

There is now a Forge tutorial for JSM Assets:

https://developer.atlassian.com/platform/forge/assets-import-app/

1 Like

Hi @ibuchanan - Thanks for sending this update.

But is there any news or target date about when Forge apps will be able to make calls using the Assets REST API?

We’ve already lost at least 20 customers who asked for features in our apps that solely rely on this ability in Forge.

Your feedback is highly appreciated so we can communicate with our customers properly.

Best,
Eduardo.

@EduardoOliveira,

I don’t know if I fully understand your question. The tutorial I linked shows how Forge apps can make calls using the Assets REST API.

If you have found some specific blockers, could you start as a new topic? Also, I realize this is easily confused with the older External Assets Platform, so for precision, perhaps you could be more specific about the desired use cases and the underlying REST API endpoints. Either way, a new thread would help me get the right people (if not me) to answer the question.

Unfortunately, when trying to make Asset API calls to GET data, Forge returns a 401 unauthorized. There seems to be no scope available to enable this yet either. For instance, I have an issue panel app that attempts to get attribute data for an Asset custom field within the issue, and it is not possible.

Heyo!

I’m following the tutorial above trying to make an AQL query to Asset’s REST API. I have given te app the required permissions (read:cmdb-object:jira). The following snippet gives me the error: Refused to connect to 'https://jira/jsm/assets/workspace/xxxxxxx/v1/object/aql?startAt=0&maxResults=100&includeAttributes={includeAttributes}' because it violates the document's Content Security Policy.

  const aqlQuery = async (formData) => {
    console.log(formData);
    console.log('AQL Query is being executed...');
    const response = await api
      .asUser()
      .requestJira(
        route`/jsm/assets/workspace/xxxxxxxxx/v1/object/aql?startAt=0&maxResults=100&includeAttributes={includeAttributes}`,
        {
          method: "POST",
          headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/json'
          },
          body: JSON.stringify({
            query: formData.aql
          }),
      }
    );

    console.log('AQL Query executed!')
  
    const data = await response.json();

    console.log('Data is:');
    console.log(data);
  };

I found out yesterday that JSM asset App access via Forge apps is controlled by this Role: jira-servicemanagement-users-companyxxxx
You’ll need to add that permission to at least the Object Schema Users.
Give it a try and let us know if it worked. I had a similar issue creating objects with Forge in assets and that permission was in the Users role, moving it to the Developers role fixed it!

3 Likes

Hi, I’m having the same issue here. Were finally able to solve it? If so, how did you do it?

Thanks and regards.