Redeem coupon interface

Allow users to redeem specific coupons by providing a coupon ID to obtain the coupon.

Points to note

  • The API uses the POST method and requires data to be submitted in application/ format
  • A valid coupon ID must be provided.
  • The user needs to log in to claim the coupon
  • The coupon may have a limit on the number of claims or an expiration date
  • Ensure that the domain address is correctly configured
  • The same user may not be able to claim the same coupon again

Request address

{域名地址}/api/coupon/code

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/coupon/code

Request Syntax

POST /api/coupon/code
Content-Type: application/json

Request Headers

This interface involves only public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
id int Is Coupon ID

Response header

This interface only involves common response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description

Usage Example

Request example

POST /api/coupon/code HTTP/1.1
Host: www.anqicms.com
Content-Type: application/x-www-form-urlencoded

{
  "id": 1
}

Response Example

{
  "code": 0,
  "msg": "领取成功"
}

Error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK