Task Annotations
This is a page about performing task annotations with the Clarifai API.
In order to keep track of each user's work assigned to a task, all the annotations of this user related to this task should be linked to the task id.
Therefore, when a user creates an annotation, the task id should be provided as below:
cURL
Javascript (REST)
1
curl -X POST \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
-d '
5
{
6
"annotations": [
7
{
8
"input_id": "{{asset_id}}",
9
"data": {
10
"concepts": [
11
{
12
"id": "tree",
13
"value": 1
14
},
15
{
16
"id": "water",
17
"value": 0
18
}
19
]
20
},
21
"annotation_info": {
22
"task_id": "{{task_id}}"
23
}
24
}
25
]
26
}'\
27
https://api.clarifai.com/v2/annotations
Copied!
1
const raw = JSON.stringify({
2
"user_app_id": {
3
"user_id": "{YOUR_USER_ID}",
4
"app_id": "{YOUR_APP_ID}"
5
},
6
"annotations": [
7
{
8
"input_id": "{{asset_id}}",
9
"data": {
10
"concepts": [
11
{
12
"id": "tree",
13
"value": 1
14
},
15
{
16
"id": "water",
17
"value": 0
18
}
19
]
20
},
21
"annotation_info": {
22
"task_id": "{{task_id}}"
23
}
24
}
25
]
26
});
27
28
const requestOptions = {
29
method: 'POST',
30
headers: {
31
'Accept': 'application/json',
32
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
33
},
34
body: raw
35
};
36
37
fetch("https://api.clarifai.com/v2/annotations", requestOptions)
38
.then(response => response.text())
39
.then(result => console.log(result))
40
.catch(error => console.log('error', error));
Copied!
Last modified 3m ago
Copy link
Edit on GitHub