Skip to main content

Manual claim

This endpoint is used to allow a user to manually claim a reward for completing the quest.

POST /v1/projects/{projectId}/quests/{questId}/user/{userId}/rewards/claim

Parameters

  • projectId (string): The ID of your project.
  • questId (string): The ID of the quest for which the user is claiming a reward.
  • userId (string): The ID of the user who is claiming the reward.

Response

If successful, the response will be an HTTP 200 OK status code with an empty response body.

If the user has already claimed the reward for this quest, the response will be an HTTP 400 Bad Request status code with an error message indicating that the reward has already been claimed.

If the quest does not exist or is not active, the response will be an HTTP 404 Not Found status code with an error message indicating that the quest was not found.

Example

public IEnumerator ClaimQuestReward(string projectId, string questId, string userId)
{
string endpoint = $"/v1/projects/{projectId}/quests/{questId}/user/{userId}/reward/claim";

using (UnityWebRequest www = UnityWebRequest.Post(endpoint, ""))
{
yield return www.SendWebRequest();

if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError)
{
Debug.LogError($"Error claiming quest reward: {www.error}");
}
else
{
Debug.Log($"Quest reward claimed successfully for quest {questId} and user {userId}");
}
}
}