Upload a single file#
Description#
Accepts CSV, TSV, or JSON files, or a ZIP file that contains a single CSV, TSV, or JSON file. If a ZIP, it must contain a CSV, TSV, or JSON file, and the name of the CSV, TSV, or JSON file is also used with the imported file. Downloading this file again downloads the source. Note that all files uploaded must have a .csv, .tsv, or .json extension. JSON files are expected to have a single JSON record per line; a JSON file is a series of JSON objects delimited by a newline character.
POST /api/v1/file
Required OAuth Scopes
No OAuth scopes are required to use this endpoint.
Parameters#
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
tableId |
query |
string |
true |
The unique table identifier associated with this file |
name |
query |
string |
false |
No longer in use, here to ensure backwards compatibility |
url |
query |
string |
false |
No longer in use, here to ensure backwards compatibility |
source |
query |
string |
false |
The data source to associate with the file, no more than 255 characters. This |
delimiter |
query |
string |
false |
The character to use as a delimiter within the file to separate one field from |
importDto |
query |
string |
false |
|
file |
body |
string(binary) |
false |
The physical file to upload |
Detailed descriptions#
source: The data source to associate with the file, no more than 255 characters. This field is not in use; it only keeps track of the source
delimiter: The character to use as a delimiter within the file to separate one field from another. The default is comma
Body parameter example#
file: string
Code Samples#
curl -X POST https://h.app.wdesk.com/s/wdata/prep/api/v1/file \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-G \
--data-urlencoded "tableId=string"
http POST https://h.app.wdesk.com/s/wdata/prep/api/v1/file \
Content-Type:multipart/form-data \
Accept:application/json \
Authorization:"Bearer {access-token}" \
tableId==string
wget --method=POST "https://h.app.wdesk.com/s/wdata/prep/api/v1/file?tableId=string" \
--output-document - \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access-token}'
import requests
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://h.app.wdesk.com/s/wdata/prep/api/v1/file', params={
'tableId': 'string'
}, headers = headers)
print(r.json())
Returns#
201 - Created#
Returns a JSON object with a body property, which contains a FileMetaDto object for the uploaded file.
Example Responses#
{
"body": {
"columnMappings": {},
"created": "string",
"delimiter": "string",
"id": "string",
"key": "string",
"metadata": {},
"name": "string",
"numErrors": "integer",
"numRecords": "integer",
"originalFileSize": "integer",
"source": "string",
"status": "string",
"tableId": "string",
"tags": {},
"updated": "string",
"userId": "string",
"version": "integer"
},
"code": "integer"
}