Create
Creates a Basic Campaign’s Tasks Group.
Warning
Campaign with unique task details supported only. If you want to increase number of slots in Campaign with fixed task details - you have to Update Task Group.
Request
POST https://ttv.microworkers.com/api/v2/basic-campaigns/{campaignId}/tasks-groups
Parameters
Path Parameter |
||
---|---|---|
Name |
Type |
Description |
campaignId |
string |
The ID of Campaign. |
Request Body
{
"tasks": [
{
"id": string,
"data": [
{
"key": string,
"value": string
}
],
"testCases": [
{
"questionId": string,
"answers": [
string
]
}
]
}
]
}
AddTasksGroupsRequest
Property |
Type |
Description |
---|---|---|
tasks |
array[TaskDataRowRequest] |
Tasks list. |
TaskDataRowRequest
Property |
Type |
Description |
---|---|---|
id |
string |
The ID of Task. If present - value must be unique and contain alpha-numeric characters only. If it’s omitted - system will generate random value. |
data |
array[KeyValueRequest] |
The list of key/value objects. |
testCases |
array[TestCaseRequest] |
The list of expected Answers to Questions. |
KeyValueRequest
Property |
Type |
Description |
---|---|---|
key |
string |
Key |
value |
string |
Value |
TestCaseRequest
Property |
Type |
Description |
---|---|---|
questionId |
string |
The ID of Question. |
answers |
array[string] |
The list of expected Answers. |
Response
Response HTTP Codes
Http Code |
Response Type |
Description |
---|---|---|
202 |
Accepted (OK) |
|
400 |
Validation Failed |
|
401 |
Unauthorized |
|
403 |
Access denied |
|
404 |
Not found |
Response HTTP Headers
On successful response API returns queue-job-id
header.
Examples
Unique task details
Settings:
Unique Task details.
Task details template contains variable:
url
.You would like to add
3
Tasks Groups to campaign.1st and 2nd tasks have custom IDs.
3rd task doesn’t have custom ID, so it will be automatically generated by system.
1st task has test case answers. Worker’s answers will be compared with test case answers.
Request body
{
"tasks": [
{
"id": "1",
"data": [
{
"key": "url",
"value": "http://clejawcu.zlatynqu.sg"
}
],
"testCases": [
{
"questionId": "Q123456789",
"answers": [
"404",
"page not found"
]
}
]
},
{
"id": "2",
"data": [
{
"key": "url",
"value": "http://zbjqxtsqpsi.vjtwuxfq.info"
}
]
},
{
"data": [
{
"key": "url",
"value": "http://zbjqxtsqpsi.vjtwuxfq.info"
}
]
}
]
}
Unique task details (campaign with sub-tasks)
Settings:
Unique Task details.
Task details template contains variables:
first_name
andlast_name
.Every Tasks Group has
2
Tasks.You would like to add
3
Tasks Groups to campaign.All tasks have custom ids.
Request body
{
"tasks": [
{
"id": "1",
"data": [
{
"key": "first_name",
"value": "Michael"
},
{
"key": "last_name",
"value": "Hildebrant"
}
]
},
{
"id": "2",
"data": [
{
"key": "first_name",
"value": "Hannah"
},
{
"key": "last_name",
"value": "Ornelas"
}
]
},
{
"id": "3",
"data": [
{
"key": "first_name",
"value": "Judy"
},
{
"key": "last_name",
"value": "Stoker"
}
]
},
{
"id": "4",
"data": [
{
"key": "first_name",
"value": "Richard"
},
{
"key": "last_name",
"value": "Williams"
}
]
},
{
"id": "5",
"data": [
{
"key": "first_name",
"value": "Judy"
},
{
"key": "last_name",
"value": "Williams"
}
]
},
{
"id": "6",
"data": [
{
"key": "first_name",
"value": "Hannah"
},
{
"key": "last_name",
"value": "Williams"
}
]
}
]
}