Restart

Restarts finished Basic Campaign.

Request

POST https://ttv.microworkers.com/api/v2/basic-campaigns/{campaignId}/restart

Parameters

Path Parameter

Name

Type

Description

campaignId

string

The ID of Campaign.

Request Body

{
  "positionsToAdd": integer,
  "tasks": [
    {
      "id": string,
      "data": [
        {
          "key": string,
          "value": string
        }
      ],
      "testCases": [
        {
          "questionId": string,
          "answers": [
            string
          ]
        }
      ]
    }
  ]
}

RestartCampaignRequest

Property

Type

Description

positionsToAdd

integer

Number of positions you would like to add to Campaign. value may be 0 if Campaign has untaken positions and you want to restart Campaign with these positions only.

tasks

array[TaskDataRowRequest]

Unique Tasks details. Required, if positionsToAdd is greater than zero and your Campaign utilize unique Tasks. In all other cases – must be omitted

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 - without adding extra positions

Settings:

  • Fixed Task details.

  • Campaign has untaken positions (campaign was stopped before all positions were taken by workers).

  • You would like to restart campaign with untaken positions only and don’t want to add extra positions.

Request body

{
  "positionsToAdd": 0
}

Fixed task details - add extra positions

Settings:

  • Fixed Task details.

  • You would like to restart campaign and add 7 extra positions to it.

Request body

{
  "positionsToAdd": 7
}

Unique task details - without adding extra positions

Settings:

  • Unique Task details.

  • Campaign has untaken positions (campaign was stopped before all positions were taken by workers).

  • You would like to restart campaign with untaken positions only and don’t want to add extra positions.

Request body

{
  "positionsToAdd": 0
}

Unique task details - add extra positions

Settings:

  • Unique Task details.

  • Task details template contains variable: url.

  • You would like to restart campaign and add 3 extra positions to it.

  • 1st and 3rd tasks have custom IDs.

  • 2nd 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

{
  "positionsToAdd": 3,
  "tasks": [
    {
      "id": "1",
      "data": [
        {
          "key": "url",
          "value": "http://clejawcu.zlatynqu.sg"
        }
      ],
      "testCases": [
        {
          "questionId": "Q123456789",
          "answers": [
            "404",
            "page not found"
          ]
        }
      ]
    },
    {
      "data": [
        {
          "key": "url",
          "value": "http://zbjqxtsqpsi.vjtwuxfq.info"
        }
      ]
    },
    {
      "id": "2",
      "data": [
        {
          "key": "url",
          "value": "http://zbjqxtsqpsi.vjtwuxfq.info"
        }
      ]
    }
  ]
}

Unique task details - add extra positions (campaign with sub-tasks)

Settings:

  • Unique Task details.

  • Task details template contains variables: first_name and last_name.

  • Every position has 2 Tasks.

  • You would like to restart campaign and add 3 extra positions to it.

  • All tasks have custom ids.

Request body

{
  "positionsToAdd": 3,
  "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"
        }
      ]
    }
  ]
}