Pete Lorenz
07/09/2024, 10:39 PMcurl --location '<https://ORG_URL/api/v1/entities/users/pete.lorenz/apiTokens/my.pat>' \
--header 'Authorization: Bearer ADMIN_TOKEN' \
--header 'Content-Type: application/vnd.gooddata.api+json'
The Swagger says I should have a response with the bearerToken in it such as:
{
"data": {
"attributes": {
"bearerToken": "string"
},
"id": "id1",
"type": "apiToken"
}...
}
However, I get a 200 response with empty attributes like this:
{
"data": {
"id": "my.pat",
"type": "apiToken",
"attributes": {}
}...
}
Am I misunderstanding how this API should work?Moises Morales
07/09/2024, 11:02 PMPete Lorenz
07/09/2024, 11:47 PMBranislav Slávik
07/10/2024, 11:05 AMtemp_token=$(curl --silent --no-progress-meter --request POST -H 'Content-type: application/vnd.gooddata.api+json' \
-H 'Authorization: Bearer ADMIN_TOKEN' \
-d '{"data":{"id":"temp.token","type":"apiToken"}}' \
$HOST_URL/api/v1/entities/users/some_user/apiTokens | jq -r .data.attributes.bearerToken)
curl --no-progress-meter --request GET -H 'Content-type: application/vnd.gooddata.api+json' \
-H "Authorization: Bearer ${temp_token}" \
$HOST_URL/api/v1/entities/workspaces/workspace_id/visualizationObjects | jq .
curl --no-progress-meter --request DELETE -H 'Content-type: application/vnd.gooddata.api+json' \
-H "Authorization: Bearer ${temp_token}" \
$HOST_URL/api/v1/entities/users/some_user/apiTokens/temp.token
Please note, that the second curl
is just an example of a call/action to get visualization objects which is executed as some_user
for which the temporary token has been created and deleted with the 3rd call.
Regarding your note about using GD SDK, did you mean the React / UI SDK? If so, then perhaps the following page:
https://www.gooddata.com/docs/gooddata-ui/latest/learn/integrate_and_authenticate/
and its subpages might be what you are looking for?Pete Lorenz
07/10/2024, 8:57 PM