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 |
---|---|---|---|---|
delimiter | body | string | false | The character to use as a delimiter within the file to separate one field from another. The default is comma |
file | body | string(binary) | false | The physical file to upload |
name | body | string | false | No longer in use, here to ensure backwards compatibility |
source | body | string | false | 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 |
tableId | body | string | true | The unique table identifier associated with this file |
url | body | string | false | No longer in use, here to ensure backwards compatibility |
Body parameter example
delimiter: string
file: string
name: string
source: string
tableId: string
url: 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}'
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}"
wget --method=POST "https://h.app.wdesk.com/s/wdata/prep/api/v1/file" \
--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', 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"
}