vlayer logovlayer
API reference

Challenges

Challenge attempts and verification

Create attempt

Start a new attempt for a challenge. The user must have a connected social account.

POST
/challenges/{challengeId}/attempts

Authorization

AuthorizationRequiredBearer <token>

API token. Send it as Authorization: Bearer <API_TOKEN>.

In: header

Path Parameters

challengeIdRequiredinteger
curl -X POST "//challenges/{challengeId}/attempts" \
  -H "Authorization: Bearer <token>"

Attempt created

{
  "data": {
    "id": 1,
    "userId": 42,
    "challengeId": 1,
    "state": "created",
    "retryCount": 0,
    "maxRetries": 10,
    "lastVerificationAt": "2019-08-24T14:15:22Z",
    "verificationDeadline": "2019-08-24T14:15:22Z",
    "stateHistory": [
      {
        "state": "string",
        "at": "2019-08-24T14:15:22Z",
        "reason": "string"
      }
    ],
    "metadata": {},
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
}

Progress attempt state

Advance the attempt through the state machine. Actions: target_opened (user viewed the post), claim_completion (user claims they commented).

PATCH
/challenges/{challengeId}/attempts/{attemptId}

Authorization

AuthorizationRequiredBearer <token>

API token. Send it as Authorization: Bearer <API_TOKEN>.

In: header

Request Body

application/jsonRequired
actionRequiredstring
Value in: "target_opened" | "claim_completion"

Path Parameters

challengeIdRequiredinteger
attemptIdRequiredinteger
curl -X PATCH "//challenges/{challengeId}/attempts/{attemptId}" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "target_opened"
  }'

Attempt updated

{
  "data": {
    "id": 1,
    "state": "target_opened"
  }
}