POST
/
api
/
loyalty
/
questions_responses
import SnagSolutions from '@snagsolutions/sdk';

const client = new SnagSolutions({
  apiKey: process.env['X_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const response = await client.loyalty.questionsResponses.submit({
    loyaltyQuestionChoiceId: '123e4567-e89b-12d3-a456-426614174001',
  });

  console.log(response.alreadySubmitted);
}

main();
{
  "response": {
    "id": "123e4567-e89b-12d3-a456-426614174002",
    "userId": "123e4567-e89b-12d3-a456-426614174003",
    "loyaltyQuestionId": "123e4567-e89b-12d3-a456-426614174004",
    "loyaltyQuestionChoiceId": "123e4567-e89b-12d3-a456-426614174005"
  },
  "isCorrect": true,
  "alreadySubmitted": false
}

Body

application/json
Body
loyaltyQuestionChoiceId
string
required

UUID of the selected choice

Example:

"123e4567-e89b-12d3-a456-426614174001"

Response

200
application/json
200

Response returned when submitting an answer to a question

response
object
required
isCorrect
boolean
required

Whether the submitted answer was correct

Example:

true

alreadySubmitted
boolean
required

Whether the user had already submitted an answer to this question

Example:

false