Classic file types are no longer available for use as of January 2021. You can transition your classic files or download a PDF. Learn More

Create a table API JSON Body

Answered
0

Comments

1 comment

  • Jeff Hickey

    Hi Jase the Ace, please see TableDto type for more information about the body parameter of the Create a new table endpoint.

    At minimum, you must include "name", "tableScehma", and "type." "datasetUpdated", "hierarchyMetadata", and "uniqueTableConstraints" can be omitted. Below is sample Python request that uses the minimum body payload to create a new Data table called "Table Name" with the column "columnName" of type string (update values in italics).

    import requests
    import json

    url = "https://h.<location>.wdesk.com/s/wdata/prep/api/v1/table"

    payload = json.dumps({
    "name": "Table Name",
    "tableSchema": {
      "columns": [
        {
          "name": "columnName",
          "type": "string"
        }
      ]
    },
    "type": "data"
    })

    headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': '<valid token>'
    }

    response = requests.request("POST", url, headers=headers, data=payload)
    print(response.text)
    0

Please sign in to leave a comment.