Datasaur
Search…
Add Label Set Item into Project's Label Set
Beside adding label set item through the Label Set Extension, we also allow users to add new label set item into existing Label Set through API.

cURL

Use the following cURL command to add one or more label set items into an existing project. You can copy and paste the following template and replace the access_token and the content of the label set items according to your needs.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{ "query": "mutation AddLabelSetItemsMutation($input: AppendLabelSetTagItemsInput!) { appendLabelSetTagItems(input: $input) { id color parentId tagName } }", "operationName": "AddLabelSetItemsMutation", "variables": { "input": { "labelSetId": "project-label-set-id", "tagItems": [ { "tagName": "LOC", "color": null }, { "tagName": "GPE", "color": null } ] } } }'
Copied!
Below is a more readable version of the above curl command's request body.
1
{
2
"query": "mutation AddLabelSetItemsMutation($input: AppendLabelSetTagItemsInput!) { appendLabelSetTagItems(input: $input) { id color parentId tagName } }",
3
"operationName": "AddLabelSetItemsMutation",
4
"variables": {
5
"input": {
6
"labelSetId": "project-label-set-id",
7
"tagItems": [
8
{ "tagName": "LOC", "color": "#FF0000" },
9
{ "tagName": "GPE", "color": null }
10
]
11
}
12
}
13
}
Copied!
  • operationName: you can fill any alphanumeric string in as the operationName. Refer to this page for best practices on choosing an operationName .
  • variables:
    • input:
      • labelSetId: string, id of the target label set in a project. Refer to this page to obtain label set ID.
      • tagItems:
        • tagName: name of the label item
        • color: valid HTML readable color code
  • query: Copy this from the example above.
💡a tag has the same meaning as label. In the near future, we will update the GraphQL Schema to refer to all instances as labels.

Response

Here is the response you can expect after issuing the cURL command. Use the id to create the project.
1
{
2
"data": {
3
"textDocument": {
4
"id": "c541e403-776a-b740-4baf-955c7be86c0d"
5
}
6
},
7
"extensions": {}
8
}
Copied!
Copy link
Contents
cURL
Response