com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.
Uploading a Dataset via REST API v10
Overview
Description | Upload a dataset |
Resource Path |
|
HTTP Method | POST |
Request Format | multipart/form-data |
Response Format | application/json |
Sample cURL command
curl -X POST -b cookies https://<ML_HOST>:<ML_HTTPS_PORT>/api/v10/datasets -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: multipart/form-data" -F datasetName='<DATASET_NAME>' -F version='<VERSION>' -F description='<DESCRIPTION>' -F sourceType='<SOURCE_TYPE>' -F destination='<DESTINATION>' -F dataFormat='<DATA_FORMAT>' -F containsHeader='<CONTAINS_HEADER>' -F file=<FILE_PATH> -k
- By default,Â
<ML_HOST>
 isÂlocalhost.
 However, if you are using a public IP, the respective IP address or domain needs to be specified. - By default,Â
<ML_HTTPS_PORT>
 has been set to 9443. However, if the port offset has been incremented byÂn
, the default port value needs to be incremented byÂn
.
Example cURL command
curl -X POST -b cookies https://localhost:9443/api/v10/datasets -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: multipart/form-data" -F datasetName='seeds' -F version='1.0.0' -F description='Seeds Dataset' -F sourceType='file' -F destination='file' -F dataFormat='CSV' -F containsHeader='true' -F file=@'seeds.csv' -k
Parameter definitions
Dataset should be uploaded as a multipart/form-data  request. Therefore, you need not pass a JSON definition payload in the request. However, you can set the following parameters in the request.Â
Parameter | Description | Required | Default value | Example |
---|---|---|---|---|
datasetName | A unique name for the dataset | Yes | None | diabetes |
sourceType | Storage type of the source of the dataset (file/HDFS/WSO2 DAS) | Yes | file | file |
destination | Storage type of the server side copy of the dataset (file/HDFS) | Yes | file | file |
dataFormat | Format of the dataset (CSV/TSV) | Yes | None | csv |
containsHeader | Whether the dataset contains a header row or not. | Yes | false | true |
comments | Comments on this dataset | Yes | None | diabetes |
sourcePath | If source type is HDFS, this should hold the absolute URI of the dataset file and if source type is BAM, this should be in <table_name>:<col_1_name>,<col_1_type>;<col_2_name>,<col_2_type> format. | Optional | None | |
version | Version of the dataset | Yes | None | 1.0 |
file | Path to dataset file, if source type is file. | Optional | None | file=@'diabetes.csv' |
description | Description about the dataset. | Optional | None | Diabetes Dataset |
Example
POST https://localhost:9443/api/v10/datasets
Sample output
For information on the properties returned of a sample dataset definition, see Sample Dataset Definition.
{ "name": "seeds", "id": 2, "tenantId": -1234, "comments": "Seeds Dataset", "dataType": "CSV", "userName": "admin", "version": "1.0.0", "sourcePath": null, "dataSourceType": "file", "dataTargetType": "file", "containsHeader": true }
REST API response
HTTP status code | 200, 400 or 500 For descriptions of the HTTP status codes, see HTTP Status Codes. |