Create

Creates a Hire Group Campaign’s Tasks Group.

Request

POST https://ttv.microworkers.com/api/v2/hire-group-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
          ]
        }
      ]
    }
  ],
  "positionsToAdd": integer
}

AddTasksGroupsRequest

Property

Type

Description

tasks

array[TaskDataRowRequest]

Tasks list. Required if campaign utilize unique task details.

positionsToAdd

integer

Number of positions you would like to add to Campaign. Required if campaign utilize fixed task details and maxPositionPerWorker is not equal to 1.

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 for 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

Fixed task details (worker allowed to take 1 position)

Warning

With such setup campaign has 1 Task Group only. If you want to add positions to it, use Update.

Fixed task details (worker allowed to take more than 1 position)

Settings:

  • Fixed Task details.

  • Worker allowed to take up to 5 positions (maxPositionPerWorker is 5).

  • You would like to create 10 Tasks Groups.

Request body

{
  "positionsToAdd": 10
}

Unique task details

Settings:

  • Unique Task details.

  • Task details template contains variable: url.

  • You would like to add 3 Tasks Groups to it.

  • 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 and last_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"
        }
      ]
    }
  ]
}