Publish Datasource

POST {{base-path}}/sites/{{site-id}}/datasources?datasourceType=tds

https://help.tableau.com/current/api/restapi/en-us/REST/restapirefpublishing.htm#publishdatasource

Request Params

KeyDatatypeRequiredDescription
uploadSessionIdstringIf you are calling this method to commit a file that was uploaded in parts, this value contains the upload session LUID that was generated by a call to Initiate File Upload. If this value is not included, the server assumes that the body of the request contains the file to be published.
datasourceTypestringhyper, tds, tdsx, or tde the kind of file that you are uploading. This value is required if you are calling Publish Data Source in order to commit a file that was previously uploaded using Append to File Upload. The value is not used if you upload a file in the body of the request.
overwritenulltrue to overwrite a data source that has the same name, or false to fail if the specified data source already exists. The default is false. If overwrite-flag is set to true but the data source doesn't already exist, the operation succeeds.
You can include both the overwrite and append parameters in a request, but they cannot both be true.
asJobnullA Boolean value that is used to publish data sources asynchronously. If you set this value to false (the default), the publishing process runs as a synchronous process. If a data source is very large, the process might time out before it finishes. If you set this value to true, the process runs asynchronously, and a job will start to perform the publishing process and return the job ID. You can check the status of the import job by calling Query Job.
appendnulltrue to append the data being published to an existing data source that has the same name. The default is false. If append-flag is set to true but the data source doesn't already exist, the operation fails.
In order to append data to a published data source on Tableau Server, both the source file and the published file must be an extract with the file extension .hyper or .tde. The schema of the source and the published extract must match.

If an extract was stored using the multiple tables option, you can't append data to it.

You can include both the overwrite and append parameters in a request, but they cannot both be true. |

Request Body

[{"name"=>"request_payload", "value"=>"<tsRequest><datasource name=\"Datasource Name\" ><connectionCredentials name=\"postgres\" password=\"admin\" embed=\"true\" ></connectionCredentials><project id=\"{{project-id}}\" ></project></datasource></tsRequest>", "datatype"=>"string"}, {"name"=>"tableau_datasource", "value"=>nil, "datatype"=>"null"}]