Import a CSV

POST /hubdb/api/v1/tables/:tableId/import

Method Details

HTTP Methods:

POST

Content Type:

multipart/form-data

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing

Import the contents of a CSV file into a HubDB table.

This endpoint takes a multipart POST request. The first part will be a set of JSON formatted options for the import.  The second part will be the CSV file you want to import.

Required Parameters How to use Description
OAuth Access Token or API Key Authorization: Bearer {token} header
or hapikey={key} query parameter.
Used to authenticate the request. Please see this page for more details about authentication.
Table ID :tableId
Used in the request URL
The ID of the table you want to import the data into.
resetTable Used in the request JSON Defaults to false. If this is set to true, the data in the CSV will replace all of the data in the table.
skipRows Used in the request JSON The number of header rows in the CSV file that should be skipped over. Defaults to 1 (skiping the first row in the CSV and treating it as a header row), set this to 0 if all of the rows in the CSV are data rows you want imported.
format Used in the request JSON Must be "csv", as only CSV files are currently supported.
columnMappings Used in the request JSON A list of mappings for the columns in the CSV to the columns in the HubDB table.

Each mapping will have the following format:
{"source":1,"target”:2}
"source" refers the column in the CSV, starting with 1.
"target" refers to the id of the table column. You can get the IDs for the columns by getting the details for the table.
primaryKeyColumn Optional, Used in the request JSON The Name of a column to deduplicate against existing rows in the database. You can get the names for the columns by getting the details for the table.
nameSourceColumn Optional, Used in the request JSON The number of the column in the CS file (starting with 1) that should be imported into the name column.
pathSourceColumn Optional, Used in the request JSON The number of the column in the CSV (starting with 1) that should be imported into the path column.