Threekit gives me an error when creating a datatable api

I am trying to create a datatable via API. According to the documentation, I need to pass the following parameters:

  • orgId
  • token
  • body

Regarding the body parameters, the documentation does not explicitly indicate which parameters to pass. However, I managed to determine the necessary parameters and am currently sending the following in my POST request:

  • file: A CSV file
  • columnInfo:
[
  { "name": "User", "type": "String" }
]
  • name: “Test”

By making the request trough Postman, it is giving me a 500 error, which is not really giving me an idea of where might issue be located

Thanks!,

Hey @lesthoward -

Hard to say from that particular CSV and apologies for the unhelpful 500 error. Will you try your call with the CSV & columnInfo below and see if it helps guide you?

Details

Raw CSV file:

column 1,column 2,column 3,column 4,column 5
hi col1,hi col2,hi col3,hi col4,hi col5

columnInfo:

[
  {"name":"column 1","type":"String"},
  {"name":"column 2","type":"String"},
  {"name":"column 3","type":"String"},
  {"name":"column 4","type":"String"},
  {"name":"column 5","type":"String"}
]

name: hello-world-520

Here’s the full API call with Org ID and token removed:

curl --location 'https://preview.threekit.com/api/datatables?orgId=ORG_ID\
--header 'accept: application/json' \
--header 'authorization: Bearer BEARER_TOKEN' \
--header 'content-type: text/csv' \
--form 'data=@"/Users/willthompson/Downloads/dttest.csv"' \
--form 'name="hello-world-520"' \
--form 'columnInfo="[{\"name\":\"column 1\",\"type\":\"String\"},{\"name\":\"column 2\",\"type\":\"String\"},{\"name\":\"column 3\",\"type\":\"String\"},{\"name\":\"column 4\",\"type\":\"String\"},{\"name\":\"column 5\",\"type\":\"String\"}]"'

Thanks @Will

I had to use quotes for the keys in the object within columnInfo.

I went from:

[
{ name: "User", type: "String" }
]

To:

[

{ "name": "User", "type": "String" }

]

and it is working fine now.

1 Like

Hi Les, I realize you got this working already, but I just updated our docs with an example in TypeScript for how this could work. Hopefully this will prove helpful in the future.

1 Like