Reputation: 1
2 problems to solve in this thread:
data
, while with 2-legged token returns like normal.Context: I have a pipeline that runs everyday and call Issues API to retrieve project issues and all relevant data such as project info and issues_type. This has been running smoothly for a year now. (Yes, I do know that issues/v1 is recently deprecated)
On Feb. 6th, 2023, I encountered a response when using the 3-legged-token to call GET /issues (v1 and v2):
{
"title": "User not found",
"details": "user not found",
"metadata": {}
}
To debug, I tried running each API call in the procedure, by following this tutorial to GET /hubs and GET /containerID https://aps.autodesk.com/en/docs/bim360/v1/tutorials/issuesv2/retrieve-container-id/.
I got this when I call GET /hubs:
GET /project/v1/hubs
Authorization: "Bearer <3-legged token>"
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/project/v1/hubs"
}
},
"data": [], <---- Uh oh
"meta": {
"warnings": [
{
"Id": null,
"HttpStatusCode": "403",
"ErrorCode": "BIM360DM_ERROR",
"Title": "Unable to get hubs from BIM360DM EMEA.",
"Detail": "You don't have permission to access this API",
"AboutLink": null,
"Source": null,
"meta": null
}
]
}
}
The meta.warnings
field with an error code is not uncommon.
I tried calling GET /hubs again but with the 2-legged token:
GET /project/v1/hubs
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/project/v1/hubs/"
}
},
"data": [
{
"type": "hubs",
"id": "<hidden>",
"attributes": {
"name": "User Hub",
"extension": {
"type": "hubs:autodesk.bim360:Account",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/hubs:autodesk.bim360:Account-1.0"
},
"data": {}
},
"region": "US"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/project/v1/hubs/<hidden>"
}
},
"relationships": {
"projects": {
"links": {
"related": {
"href": "https://developer.api.autodesk.com/project/v1/hubs/<hidden>/projects"
}
}
}
}
}
],
"meta": {
"warnings": [
{
"Id": null,
"HttpStatusCode": "403",
"ErrorCode": "BIM360DM_ERROR",
"Title": "Unable to get hubs from BIM360DM EMEA.",
"Detail": "You don't have permission to access this API",
"AboutLink": null,
"Source": null,
"meta": null
}
]
}
}
Notice that :
data
returns []
.data
returns a hub object.I tried refreshing token and checking permissions to BIM360, but nothing has changed.
TL;DR AutoDesk deprecated the Issues API, but then the API call to GET /hubs with 3-legged token returns []
, but with 2-legged token returns desired hub-object.
Upvotes: 0
Views: 117
Reputation: 2206
Firstly, Issue API (v1, v2) does not support 2-legged token. GET:Hubs , GE:"Projects etc. are Data Management API which support 2-legged token or 3-legged token.
In your test, it also failed with 3-legged token when GET:Hubs. When using Issue API, it shows [User not found]. I highly suspected this user has been removed from the BIM360 hub now or its status is abnormal. Could you check if the user is available in the hub and the project? Also test with other users if your code could work?
Upvotes: 0