I am trying to create my first Forge app. I use UI kit to offer a settings page which uses UserPicker
to select a group of users, which returns account IDs. As other bitbucket REST APIs (for example the author
field of /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}
) do not include that, but only a uuid
and I need to compare authors, I am trying to map the account ID to a UUID or vice-versa.
In the resolver of my app, I thus have this simple function:
const getUUID = async (id: AccountID): Promise<void | UUID> => {
return api.asApp().requestBitbucket(route`/2.0/users/${id}`)
.then((r) => r.json())
.then((u: User) => u.uuid);
};
However, trying to use it throws an INVALID_TARGET_URL
exception. I’ve tried logging the route
including the id
. If I use that to send a request using curl
, it works as expected and returns the user data I am interested in.
I thought I might be missing permissions, but it seems that endpoint is just publicly readable.
What am I doing wrong?