Skip to main content

Challenge attempt

Once a challenge is started, attempt is created and can be used to track the completion results. In Opigno Enterprise API it is represented as a ChallengeAttempt object:

Challenge attempt CTA

The list of available CTAs can differ depending on the attempt status.

Create a challenge attempt

A challenge can be started by the current API user if the following conditions are met:
  1. The user context is associated with an authenticated scope;
  2. The challenge is available for the current API user’s hierarchy level;
  3. The requested challenge is published and ongoing (the current date should be between start and end dates);
  4. A challenge cannot be restarted. If another attempt for the current API user exists, an error will be returned.
If a challenge can be taken by the current API user, CTA CREATE_CHALLENGE_ATTEMPT will be returned in the corresponding Challenge object. To start a challenge, execute the createChallengeAttempt mutation:

Challenge question

A challenge question is represented in Opigno Enterprise API by ChallengeQuestion object:

Get next question

Once a challenge started and attempt created, challenge questions are available for the user and can be retrieved one by one, by execution of getNextChallengeQuestion query. In case if the randomization enabled for a challenge, questions will be returned in a random order.
Unlike training activities, challenge questions will be returned not as iframe, but as a ChallengeQuestion object. The question form should and the answer submission should be implemented on the frontend.
Here is an example of the query execution:

Submit the answer

To submit a challenge answer, execute the saveChallengeQuestionAnswer mutation. It has one argument - answerData: Here is an example of the mutation execution:
After the successful execution of the mutation, ChallengeQuestionAnswer object will be returned. When the answer for the last question is submitted, a challenge attempt will be automatically closed, and the user will be able to check their results.

ChallengeQuestionAnswer object

A question answer is represented in Opigno Enterprise API as a ChallengeQuestionAnswer object:

Authentication

Understand the authentication requirements and how to properly authenticate your requests.