Getting user attributes from assets asApp

I need to read asset objects with user attributes in a background job (think a long-running job triggered via the queue). I’m doing something like:

api.asApp().requestJira(route`/jsm/assets/workspace/${workspaceId}/v1/object/aql?startAt=0&maxResults=2&includeAttributes=true`, {...})

I noticed that all the user attributes are always returned as unknown user, like this:

{
  "workspaceId": "deadbeef",
  "globalId": "deadbeef:2686",
  "id": "2686",
  "objectTypeAttributeId": "2686",
  "objectAttributeValues": [
    {
      "displayValue": "Unknown user",
      "referencedType": false,
      "user": {
        "avatarUrl": "https://api.atlassian.com/jsm/assets/workspace/deadbeef/v1/avatar/unknown-avatar.png",
        "displayName": "Unknown user",
        "isDeleted": true
      }
    }
  ],
  "objectId": "2884721"
}

My app has all the appropriate scopes to see the asset schema. It can run the queries and see all the other attributes.

It also doesn’t have any problems seeing the users in Jira itself. It’s just the assets.

Is this a known restriction on the assets API? Am I missing something? How can I get all this data in a background job in Forge?

@KonradGarus1,

Yes, known:

But not well documented and not tracked as an issue. It would help to have someone (who is not an Atlassian) log it as a Suggestion for the Assets platform. I have channeled the above feedback to the team but they don’t seem to understand the issue on the face of it. My advice is to make sure you explain why it’s a problem, not just state that it is.

Currently, you have to use asUser with impersonation if you are running in a back-end or background context.

Thank you, asUser with impersonation seems to make the difference. Of course it comes with other drawbacks, but at least it lets us move forward here.

Looks like I can’t see any work items in the ASSETS project you linked. I can’t create them either.

@KonradGarus1,

Apologies. The ASSETS project is empty on JAC so “can’t see any” is expected. I wan’t expecting, “can’t create”. Can you create suggestions here?https://jira.atlassian.com/projects/ECO

I can see the tickets in ECO, but not create one.

How frustrating. Sorry to send you on a wild goose chase.

See ECO-1808. Please watch, vote, and comment.