Datasaur
Search…
Export Project
You can export a project by exporting a single file or exporting all files. You can also download a project using five different methods (direct download, email, webhook, file storage, external file storage). These methods are fully explained here. This page describes how to accomplish the above using the API.

Export File

You could try this cURL command for exporting certain file.

cURL

1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{"operationName":"ExportTextProjectDocumentQuery","variables":{"input":{"documentId":"f788941b-ac0a-49ff-a325-08efdaa00831","fileName":"NER-file-2_output_Jun_15_2020","format":"iob","method":"EMAIL"}},"query":"query ExportTextProjectDocumentQuery($input: ExportTextProjectDocumentInput!) { result: exportTextProjectDocument(input: $input) { redirect fileUrl queued __typename }}"}'
Copied!
Below is the more readable version of request body from cURL command above.
1
{
2
"operationName": "ExportTextProjectDocumentQuery",
3
"variables": {
4
"input": {
5
"documentId": "f788941b-ac0a-49ff-a325-08efdaa00831",
6
"fileName": "NER-file-2_output_Jun_15_2020",
7
"format": "iob",
8
"method": "EMAIL"
9
}
10
},
11
"query": "query ExportTextProjectDocumentQuery($input: ExportTextProjectDocumentInput!) { result: exportTextProjectDocument(input: $input) { redirect fileUrl queued __typename }}"
12
}
Copied!
    operationName: you can fill any alphanumeric string in as the operationName. ExportTextProjectDocumentQuery is fine as a default. Refer this page to organise operationName properly.
    variables
      input: See Input Parameter Table below.
    query: Copy it from cURL example.
Input Parameter
Description
Example
fileName
Custom file name
NER-file-2_output_Jun_15_2020
format
Refer to this page. Use lowercase. Use custom if you want to use export custom script.
iob
customScriptId
Fill this if you use custom format.
1
documentId
Document Id
f788941b-ac0a-49ff-a325-08efdaa00831
method
Export method: EMAIL, DOWNLOAD, CUSTOM_WEBHOOK, FILE_STORAGE, EXTERNAL_FILE_STORAGE
EMAIL
url
Webhook URL (only works for CUSTOM_WEBHOOK)
​
secret
Refer to here.
​
externalFileStorageParameter
See table below
​
externalFileStorageParameter
Description
Example
bucketName
AWS S3 Bucket Name
my-bucket
objectPath
directory path to store the exported file
​
accessKeyId
AWS Access Key Id
AK2234111K4452681AXO
secretAccessKey
AWS Secret Access Key
MADCTTTTAM23455B/svbjrzd32spfvmbZN4dI+1c2

Response

Here is the response when you execute the cURL command above.
1
{
2
"data": {
3
"result": {
4
"redirect": null,
5
"fileUrl": null,
6
"queued": true,
7
"__typename": "ExportRequestRedirectResult"
8
}
9
},
10
"extensions": {}
11
}
Copied!
    redirect: Open the url if you choose method DOWNLOAD
    queued: It shows that export process has been already queued. Please check your email or webhook to retrieve your file url.
    fileUrl: It contains file url to download if you choose method FILE_STORAGE
      Please wait for the file is ready.
This means that the export request is already queued and Datasaur will generate the files and send them to you based on the selected method.

Export All Files

cURL

1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{"operationName":"ExportTextProjectQuery", "variables":{"input":{"fileName":"NER-Hope-2_output_Jun_15_2020","format":"iob","projectId":"projectId","role":"LABELER","method":"EMAIL"}},"query":"query ExportTextProjectQuery ($input: ExportTextProjectInput!) { result: exportTextProject(input: $input) { redirect fileUrl queued __typename }}"}'
Copied!
Below is the more readable version of request cURL command above.
1
{
2
"operationName": "ExportTextProjectQuery",
3
"variables": {
4
"input": {
5
"fileName": "Hello_world_output_Jun_15_2020",
6
"format": "iob",
7
"projectIds": ["projectId"],
8
"role": "LABELER",
9
"method": "EMAIL"
10
}
11
},
12
"query": "query ExportTextProjectQuery ($input: ExportTextProjectInput!) { result: exportTextProject(input: $input) { redirect fileUrl queued __typename }}"
13
}
Copied!
    operationName: you can fill any alphanumeric string in as the operationName. ExportTextProjectQuery is fine as a default. Refer this page to organise operationName properly.
    variables
      input: See Input Parameter Table below.
    query: Copy it from cURL example.
Input Parameter
Description
Example
fileName
Custom file name
Hello_world_output_Jun_15_2020
format
Refer to this page. Use lowercase. Use custom if you want to use export custom script.
iob
customScriptId
Fill this if you use custom format.
1
projectIds
Project Id List, array of Project Id
["projectId1", "projectId2"]
role
Exporter role. There are two possible roles: LABELER, REVIEWER
LABELER
method
Export method: EMAIL, DOWNLOAD, CUSTOM_WEBHOOK, FILE_STORAGE, EXTERNAL_FILE_STORAGE
EMAIL
url
Webhook URL (only works for CUSTOM_WEBHOOK)
​
secret
Refer to here.
​
externalFileStorageParameter
Only works for EXTERNAL_FILE_STORAGE
​
externalFileStorageParameter
Description
Example
bucketName
AWS S3 Bucket Name
my-bucket
objectPath
directory path to store the exported file
​
accessKeyId
AWS Access Key Id
AK2234111K4452681AXO
secretAccessKey
AWS Secret Access Key
MADCTTTTAM23455B/svbjrzd32spfvmbZN4dI+1c2

Response

Here is the response when you execute the cURL command above.
1
{
2
"data": {
3
"result": {
4
"redirect": null,
5
"fileUrl": null,
6
"queued": true,
7
"__typename": "ExportRequestRedirectResult"
8
}
9
},
10
"extensions": {}
11
}
Copied!
    redirect: Open the url if you choose method DOWNLOAD
    queued: It shows that export process has been already queued. Please check your email or webhook to retrieve your file url.
    fileUrl: It contains file url to download if you choose method FILE_STORAGE
      Please wait for the file is ready.
This means that the export request is already queued and Datasaur will generate the files and send them to you based on the selected method.
You can refer to the GraphQL Schema section to see more about the export query.
Last modified 3mo ago