Перейти к основному содержимому

Generate Token Code for User API

POST /generateTokenCodeForUser

Description

This API endpoint generates a token code for a user, which can be used for applying discounts or other purposes.

Request Body

The request utilizes GraphQL to perform the generateTokenCodeForUser mutation.

Mutation:

mutation generateTokenCodeForUser ($tokenCodeView: TokenCodeView) {
generateTokenCodeForUser (tokenCodeView: $tokenCodeView) {
tokenCode
message
}
}

Variables:

{
"tokenCodeView": {
"userId": <User_Id>,
"discountRate": <Discount_Rate>
}
}
  • userId (Int): The ID of the user for whom the token code is generated.
  • discountRate (Int): The discount rate associated with the token code.

Response:

  • Success (200 OK):

    • If the token code is successfully generated, the response will include the generated token code and a message.
    {
    "data": {
    "generateTokenCodeForUser": {
    "tokenCode": "<Generated_Token_Code>",
    "message": "<Success_Message>"
    }
    }
    }
  • Error (4XX/5XX):

    • If there is an issue generating the token code, such as invalid user ID or discount rate, the response will include an appropriate error message and status code.

Note:

Ensure the userId is valid and discountRate is set appropriately to generate the token code successfully.