大体流程如下:
第一步,获取token,请求URL如下:
http://124.**.**.**:63192/api/3.8/auth/signin
返回如下:(获取token)
<?xml version='1.0' encoding='UTF-8'?>
<tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-3.8.xsd">
<credentials token="YN7jdyJ8T7S8AMjwM9gWmA|LH0iXKLrGYgMG8ArA4YGhGG1V1icr8Fb">
<site id="baccc514-ef62-48dc-b964-c153c3f6c464" contentUrl=""/>
<user id="5a328439-9b3d-4197-ab4c-f334839061f7"/>
</credentials>
</tsResponse>
第二步,用token请求获取站点ID:
请求URL:
http://124.**.**.**:63192/api/3.9/sites
返回结果如下:
{
"pagination": {
"pageNumber": "1",
"pageSize": "100",
"totalAvailable": "2"
},
"sites": {
"site": [
{
"id": "baccc514-ef62-48dc-b964-c153c3f6c464",
"name": "Default",
"contentUrl": "",
"adminMode": "ContentAndUsers",
"disableSubscriptions": true,
"state": "Active",
"revisionHistoryEnabled": true,
"revisionLimit": "25",
"subscribeOthersEnabled": false,
"allowSubscriptionAttachments": true,
"guestAccessEnabled": true,
"cacheWarmupEnabled": true,
"dataAlertsEnabled": true,
"commentingEnabled": true,
"commentingMentionsEnabled": true,
"flowsEnabled": false,
"extractEncryptionMode": "disabled",
"dataAccelerationMode": "enable_selective",
"catalogingEnabled": false,
"derivedPermissionsEnabled": true,
"webExtractionEnabled": true,
"askDataMode": "EnabledByDefault",
"runNowEnabled": true,
"userVisibilityMode": "FULL",
"requestAccessEnabled": true,
"authoringEnabled": true,
"customSubscriptionEmailEnabled": false,
"customSubscriptionFooterEnabled": false,
"namedSharingEnabled": true
}
]
}
}
第三步,使用站点ID获取站点内容:
请求URL:
http://124.**.**.**:63192/api/3.9/sites/baccc514-ef62-48dc-b964-c153c3f6c464/workbooks
返回结果:
{
"pagination": {
"pageNumber": "1",
"pageSize": "100",
"totalAvailable": "18"
},
"workbooks": {
"workbook": [
{
"project": {
"id": "fd43940e-9581-11ea-b965-a72ac3f8c8fb",
"name": "默认值"
},
"owner": {
"id": "5a328439-9b3d-4197-ab4c-f334839061f7",
"name": "admin"
},
"tags": {},
"dataAccelerationConfig": {
"accelerationEnabled": false
},
"id": "14def8ac-ae8b-42ee-8c22-723827f5022e",
"name": "工作簿 1",
"description": "",
"contentUrl": "1",
... ...
你这3个请求是有关联性的,所以不能同时发送出去。只能在成功后的回调函数里再进行下一个请求;