Using a forge app to query assets via AQL

I’m trying to read assets from an AQL query via forge - and I am only ever getting a 400 error. - code is below:

        const bodyData = `{"qlQuery": "ObjectType = Event"}`;

        const res = await requestJira(
          `/jsm/assets/workspace/${workspaceId}/v1/object/aql?startAt=0&maxResults=100&includeAttributes=false`,
          {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json'
            },
            body: bodyData,
          });

I believe I’ve been round the docs and can’t for the life of me work out my error.

If I raise the request from outside forge - I get a poco error:

“‘poco: rejected authenticated request with decisionId: xxxxxxxxxx \nUTC Time: 2026-01-14 14:25:34.282044637 +0000 UTC \nFollow the troubleshooting guide at go/poco-troubleshooting’”

Any ideas where I’m going wrong?

1 Like

The block below is working for me. Be sure to include read:cmdb-object:jira in your manifest. I’m also using asApp for the request permissions. You will need to grant the app the necessary permissions in Assets to be able to access objects.

const aql = 'objectTypeId=1';
const response = await api.asApp().requestJira(
  route`/jsm/assets/workspace/${workspaceId}/v1/object/aql`,
  {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      qlQuery: aql,
    }),
  }
);
const data = await response.json();
return data;

Hi,
It works only for 25 results max…
The parameters “startAt” and “maxResults” doesn’t work… so no pagination possible

I believe in the POST, you must put the startat and maxResults in the post body like: {
“qlQuery”: “objectType = “PPM Resources” AND “Start Date” IS NOT EMPTY”,
“startAt”: 0,
“maxResults”: 50,
“includeAttributes”: true,
“includeAttributesDeep”: 1
}