Skip to main content

Upload data using REST API

API Specs

Api Endpoint  : /v1/projects/<Your-Project-ID>/upload

Request type : POST

Authorization: Bearer <token>

Content Type : multipart/form-data or application/json

The data can be uploaded as FormData or as JSON

FormData

FormData should be used when the data is in file.

The key name of the files should be uploadfile or else the API will throw an error.

Form body

KeyExampleRequiredNoteTypeDefault
formatJSONLtrueThe format of the data uploadStringnull
json-map“{"Completed":"completed","Key":"key",
"Data":"Data","MetaData":"Entities",
"Prev":"prev","Next":"next","IsAcharya":true}”
falseused only in case of JSONL data,
If the values are not given the default values would be attempted with
String{Key: "key", Next: "next", Prev: "prev", Data: "data", MetaData: "meta_data",
IsAcharya: true, Completed: "completed"}
mark-evalfalsefalsethe record evaluation will be set to true or false depending on the valueStringfalse
upload-nametest-datafalseThe name that the upload will be associated withString
upload-sourcesparkfalsedenotes the source of the uploadString
uploadFile@/home/user/Desktop/back/test.jsonltruePath to the file which contains the dataStringnull

Example CURL

curl --location --request POST 'http://localhost:3000/v1/projects/Prj-24/upload?test=false' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImI1YWNjNjViLTdjM2EtNDM0MC05NTk1LTQ1Y2JhNjk5MjAxZCIsInJvbGUiOiIiLCJlbWFpbCI6ImFkbWluQGxvY2FsaG9zdCIsImlzcyI6IkFjaGFyeWEifQ.9zW8YPRn8WpeLJQzrhWVNsdnce6IypxeRAcZffgYkGA' \
--form 'jsonMap="{\"Key\":\"id\",\"Data\":\"text\", \"MetaData\":\"lables\"}"' \
--form 'markComplete="false"' \
--form 'markEval="false"' \
--form 'format="JSONL"' \
--form 'uploadName="upload-from-postman"' \
--form 'tags="tag1"' \
--form 'tags="tag2"' \
--form 'isAcharya="true"' \
--form 'uploadFile=@"/C:/Users/nithi/Downloads/screencapture-localhost-3000-2021-11-27-21_05_57.pdf"' \
--form 'uploadFile=@"/C:/Users/nithi/Downloads/alexandru-acea-5O0nPYaXoi0-unsplash.jpg"'

Example Response:

{
"warnings": null,
"infos": null,
"errors": null,
"recordDetails": {
"totalRecords": 13,
"insertedRecords": 13,
"invalidRecords": 0,
"errorRecords": 0
},
"uploadDetails": {
"Name": "[uname]",
"UploadedFrom": "restapi",
"UploadTime": "2020-10-09T16:39:33.339963026+05:30",
"User": "admin@localhost",
"UploadID": "5",
"UploadSource": "Hadoop"
}
}

JSON

JSON can be used to upload content directly