Skip to main content

Hi,

 

I have successfully created a PAT (Personal Access Token) after logging into my Cloud Tableau account and generating one. However, when I try to execute:

 

curl "https://us-east-1.online.tableau.com/api/3.4/sites/<SITE_ID>/workbooks/<WORKBOOK_ID>/" -H "X-Tableau-Auth:<PAT>"

 

I am getting an authentication error (401002). The PAT is definitely correct, I've tried two now, neither work :-0.

 

This is based on the following documentation:

 

https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_get_started_tutorial_part_1.htm#add-credentials-to-a-rest-call

 

Which I believe supersedes below for cloud users, (who are all about to be enforced with MFA):

 

https://help.tableau.com/current/online/en-us/security_personal_access_tokens.htm) supersedes the signin documentation here

 

Please help, thanks

Richard Browne

4 个回答
  1. 2022年9月7日 13:31

    @Richard Browne​ 

    First, you would need to sign in with something like:

    curl --location --request POST 'https://us-east-1.online.tableau.com/api/3.16/auth/signin' \

    --header 'Content-Type: application/json' \

    --header 'Accept: application/json' \

    --data-raw '{

    "credentials": {

    "site": {

    "contentUrl": "yoursite"

    },

    "personalAccessTokenName": "Tokname",

    "personalAccessTokenSecret": "wmAEuP0hA==:FR4FuMt9U"

    }

    }'

    After login, you would receive a response like:

    {

    "credentials": {

    "site": {

    "id": "3aa0c-68d-4054-a12a-ce7f6146",

    "contentUrl": "yoursitename"

    },

    "user": {

    "id": "53717a93-3839-40f-8f29-efe3fbb8"

    },

    "token": "guQ9rE991e0c-6e56146",

    "estimatedTimeToExpiration": "364:23:59"

    }

    }

    with a token. and a site id that you would use on your next api call.

     

    Then, if you have the workbook id, then you can use:

    curl --location --request GET 'https://prod-useast-b.online.tableau.com/api/3.16/sites/3aa0c-68d-4054-a12a-ce7f6146/workbooks/9b18be-49-404-90-bb2d4e9b' \

    --header 'X-Tableau-Auth: guQ9rE9ieova|3aa91e0c-6e56146' \

    --header 'Accept: application/xml' \

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000