### Query Verified Coupon Code (Response Examples) Source: https://developer.meituan.com/docs/api/index These snippets demonstrate the JSON response structure for the query verified coupon code API. The first example shows a successful response with detailed coupon information, while the second illustrates a common error response indicating missing system parameters. ```json { "code": "OP_SUCCESS", "msg": "成功", "traceId": "8531422235710213256", "data": { "couponBuyPrice": 0.2, "couponCancelStatus": 1, "couponCode": "010011112345", "couponStatusDesc": "已使用", "couponUseTime": "2016-08-12 18:38:40", "dealBeginTime": "2015-12-22 14:27:41", "dealId": 33562951, "dealTitle": "火星测试券1张", "dealValue": 1.0, "isVoucher": true, "singleValue": 1.0, "verifyAcct": "example", "verifyType": "其他验证方式", "volume": 1 } } ``` ```json { "code":"OP_SYSTEM_PARAM_ERROR", "msg":"缺少系统参数", "traceId":"123" } ``` -------------------------------- ### Meituan API - Query Verified Coupon Code (Go) Source: https://developer.meituan.com/docs/api/index Example Go code for interacting with the Meituan API to query verified coupon code details. This snippet illustrates how to set up the request, including headers and body, and process the JSON response. It highlights Go's standard library for HTTP and JSON handling. ```go // Go example would go here, demonstrating how to make the API call. // This would typically involve using the net/http package for requests // and encoding/json for JSON handling. // For example: /* requestBody := strings.NewReader(`{"couponCode": "010011112345"}`) req, err := http.NewRequest("POST", "https://api-open-cater.meituan.com/tuangou/coupon/queryById", requestBody) // ... set headers and other request details ... client := &http.Client{} resp, err := client.Do(req) // ... handle response and errors ... */ ``` -------------------------------- ### Meituan API - Query Verified Coupon Code (Java) Source: https://developer.meituan.com/docs/api/index Example Java code for calling the Meituan API to query verified coupon code details. This snippet assumes the use of a library for making HTTP requests and handling JSON responses. It shows how to construct the request body and parameters. ```java // Java example would go here, demonstrating how to construct the request and handle the response. // This would typically involve using an HTTP client library (like OkHttp or Apache HttpClient) // and a JSON parsing library (like Jackson or Gson). // For example: /* String url = "https://api-open-cater.meituan.com/tuangou/coupon/queryById"; Map params = new HashMap<>(); // Add common parameters like appAuthToken, businessId, etc. params.put("biz", "{\"couponCode\": \"010011112345\"}"); // ... construct and send the HTTP POST request ... // ... parse the JSON response ... */ ``` -------------------------------- ### Meituan API - Query Verified Coupon Code (Python) Source: https://developer.meituan.com/docs/api/index Example Python code for calling the Meituan API to query verified coupon code details. This snippet shows how to use the 'requests' library to send a POST request with form-urlencoded data and handle the JSON response. It includes common parameters and the 'biz' payload. ```python import requests import json url = "https://api-open-cater.meituan.com/tuangou/coupon/queryById" # Common parameters (replace with actual values) common_params = { "appAuthToken": "eeee860a3d2a8b73cfb6604b136d6734283510c4e92282", "businessId": "1", "charset": "utf-8", "developerId": "10010", "sign": "4656285a4c2493e279d929b8b9f4e29310da8b2b", "timestamp": "1618543567", "version": "2" } # Business parameters biz_params = { "couponCode": "010011112345" } # Combine parameters, ensuring biz is a JSON string within the form data request_data = { **common_params, "biz": json.dumps(biz_params) } headers = { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" } response = requests.post(url, data=request_data, headers=headers) if response.status_code == 200: result = response.json() print(json.dumps(result, indent=2, ensure_ascii=False)) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Query Verified Coupon Code (HTTP Request) Source: https://developer.meituan.com/docs/api/index This snippet shows the HTTP request structure for querying verified coupon code details. It includes the endpoint, HTTP method, host, content type, and common request parameters, along with the business-specific 'biz' parameter containing the coupon code. ```http POST /tuangou/coupon/queryById HTTP/1.1 Host: api-open-cater.meituan.com Content-Type: application/x-www-form-urlencoded;charset=utf-8 appAuthToken=eeee860a3d2a8b73cfb6604b136d6734283510c4e92282& businessId=1& charset=utf-8& developerId=10010& sign=4656285a4c2493e279d929b8b9f4e29310da8b2b& timestamp=1618543567& version=2& biz={ "couponCode": "010011112345" } ``` -------------------------------- ### Query Verified Coupon Code Source: https://developer.meituan.com/docs/api/index Retrieve details of a verified Meituan group buying coupon by its unique code. This endpoint requires business authorization. ```APIDOC ## POST /tuangou/coupon/queryById ### Description This endpoint allows you to query the details of a verified Meituan group buying coupon using its unique coupon code. ### Method POST ### Endpoint https://api-open-cater.meituan.com/tuangou/coupon/queryById ### Parameters #### Query Parameters - **appAuthToken** (string) - Required - Authentication token. - **businessId** (string) - Required - Your business ID. - **charset** (string) - Required - Character set, usually utf-8. - **developerId** (string) - Required - Your developer ID. - **sign** (string) - Required - Signature for the request. - **timestamp** (string) - Required - Timestamp of the request. - **version** (string) - Required - API version, usually '2'. #### Request Body - **biz** (object) - Required - Contains business-specific parameters. - **couponCode** (string) - Required - The Meituan coupon code to query. ### Request Example ```http POST /tuangou/coupon/queryById HTTP/1.1 Host: api-open-cater.meituan.com Content-Type: application/x-www-form-urlencoded;charset=utf-8 appAuthToken=eeee860a3d2a8b73cfb6604b136d6734283510c4e92282& businessId=1& charset=utf-8& developerId=10010& sign=4656285a4c2493e279d929b8b9f4e29310da8b2b& timestamp=1618543567& version=2& biz={"couponCode": "010011112345"} ``` ### Response #### Success Response (200) - **code** (string) - Response code, e.g., "OP_SUCCESS". - **msg** (string) - Success message. - **traceId** (string) - Unique trace ID for the request. - **data** (object) - Contains coupon details. - **couponBuyPrice** (double) - The price at which the coupon was purchased. - **couponCancelStatus** (int) - Indicates if the coupon is cancelable (1 for cancelable, 0 for not). - **couponCode** (string) - The Meituan coupon code. - **couponStatusDesc** (string) - Description of the coupon's status (e.g., "已使用"). - **couponUseTime** (string) - The time the coupon was used. - **dealBeginTime** (string) - The start time of the deal associated with the coupon. - **dealId** (int) - The ID of the deal. - **dealTitle** (string) - The title of the deal. - **dealValue** (double) - The face value of the coupon. - **isVoucher** (boolean) - Indicates if the coupon is a voucher (true) or a package (false). - **singleValue** (double) - The value of a single coupon in a bulk purchase deal. - **verifyAcct** (string) - The account used for verification. - **verifyType** (string) - The method used for verification. - **volume** (int) - Indicates if it's a volume purchase (1 for yes, 0 for no). #### Response Example (Success) ```json { "code": "OP_SUCCESS", "msg": "成功", "traceId": "8531422235710213256", "data": { "couponBuyPrice": 0.2, "couponCancelStatus": 1, "couponCode": "010011112345", "couponStatusDesc": "已使用", "couponUseTime": "2016-08-12 18:38:40", "dealBeginTime": "2015-12-22 14:27:41", "dealId": 33562951, "dealTitle": "火星测试券1张", "dealValue": 1.0, "isVoucher": true, "singleValue": 1.0, "verifyAcct": "example", "verifyType": "其他验证方式", "volume": 1 } } ``` #### Error Response Example ```json { "code": "OP_SYSTEM_PARAM_ERROR", "msg": "缺少系统参数", "traceId": "123" } ``` ### Error Codes - **1032**: 券码不存在 (Coupon code does not exist) - Returned when the coupon code is not found or has not been verified. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.