Datasaur
Search…
Token-Based Projects

cURL

Use the following cURL command to create a project. You can copy and paste the following template and replace the access_token, teamId, assignees, and file upload fields, etc. as appropriate.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--form 'operations={
4
"operationName": "LaunchTextProjectMutation",
5
"variables": {
6
"input": {
7
"teamId": 1,
8
"name": "the little prince",
9
"documentSettings": {
10
"allTokensMustBeLabeled": false,
11
"allowArcDrawing": true,
12
"allowMultiLabels": true,
13
"textLabelMaxTokenLength": 999999,
14
"allowCharacterBasedLabeling": false,
15
"kind": "TOKEN_BASED"
16
},
17
"projectSettings": {
18
"consensus": 1,
19
"enableEditLabelSet": true,
20
"enableEditSentence": true
21
},
22
"assignees": [
23
{
24
"email": "[email protected]",
25
"documentNames": ["the little prince"],
26
"role": "LABELER"
27
}
28
],
29
"tagNames": ["ProjectA", "ProjectB"],
30
"documents": [
31
{
32
"name": "the little prince",
33
"file": null,
34
"fileName": "littleprince.txt",
35
"settings": {
36
"guidelineID": "1"
37
}
38
}
39
],
40
"labelSetId": "789"
41
}
42
},
43
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) {\n launchTextProject(input: $input) {\n id\n rootDocumentId\n settings {\n consensus\n enableEditLabelSet\n enableEditSentence\n __typename\n }\n __typename\n }\n}\n"
44
}' \
45
--form 'map={"1":["variables.input.documents.0.file"]}' \
46
--form '1=@littleprince.txt'
Copied!
    operationName: you can fill any alphanumeric string in as the operationName. Refer this page for best practices on choosing an operationName .
    variables
      teamId: id of the team where we want to create the project.
      name: Name for the project.
      documentSettings
        allTokensMustBeLabeled: This and the following settings can be set to true or false. This setting ensures every token in token-based project must have at least one label.
        allowArcDrawing: arrows are enabled and can be drawn between label in token-based project.
        allowMultiLabels: a single token or token spans can support multiple labels.
        textLabelMaxTokenLength: determines how many tokens can be covered by a single label. 999999 is usually fine as a default value here.
        allowCharacterBasedLabeling: allows placing labels on character spans instead of token spans.
        kind: Use TOKEN_BASED as the value here since we want to create a token-based labeling project.
          TOKEN_BASED
          ROW_BASED
          DOCUMENT_BASED
      projectSettings
        consensus: peer review / labeler consensus. This determines how many labelers must agree in order for the system to automatically accept the label.
        enableEditLabelSet: labelers will be restricted from adding or removing labels from the label set while labeling.
        enableEditSentence: labelers will be able to edit the original text while labeling.
      assignees
        email: this refers to the user's email. Datasaur will throw an error if the email is not found on the team.
        documentNames: Optional. List of document names. It refers to the field documents.fileName below. If not specified, all documents will be assigned to the team member above.
        role: Optional. This determines the assignment role.
          LABELER
          REVIEWER
      tagNames: a list of tag names to apply to a project. This parameter is optional and the type is string array.
      documents: list of documents or files to be attached to this project. Every document must have the fields: name and fileName. There are optional fields, such as settings and fileUrl. Please see GraphQL schema for more information.
        name: Document name.
        fileName: File name. This can be used in the documentNames field above.
        file: Use null.
        settings
          guidelineID: Put guideline ID here.
      labelSetId: in order to generate a labelSetId, please follow the instructions on this page to create and upload a label set.
    query: Copy it from cURL example.
💡 You can check this page to see how to upload a file in GraphQL.

Sample File

We provide this file as an example for the main text for your cURL command above.
littleprince.txt
1KB
Binary

Response

Here is the response you can expect after issuing the cURL command.
1
{
2
"data": {
3
"launchTextProject": {
4
"id": "525",
5
"rootDocumentId": "caa436bd-848c-4151-b5d4-ca57530c47b5",
6
"settings": {
7
"consensus": 0,
8
"enableEditLabelSet": false,
9
"enableEditSentence": false,
10
"__typename": "ProjectSettings"
11
},
12
"__typename": "Project"
13
}
14
},
15
"extensions": {}
16
}
Copied!
Last modified 1mo ago
Copy link