### cURL API Request Example Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Example of a POST request to the queryData endpoint using cURL. ```bash curl --location 'https://open-eu.uat.xpeng.com/open/oauth2/queryData?appId=YOUR_APP_ID&nonce=1787020880806&sign=YOUR_SIGN' \ --header 'Content-Type: application/json' \ --data '{ "openId": "6c6d6091390ffb38e70935b31397e0672e3e8cd8", "accessToken": "eyJ0eXBlIjoxLCJ2ZXJzaW9uIjoiMS4wLjAiLCJhbGciOiJIUzI1NiJ9...", "enterpriseName": "XXXX Enterprise Name", "scopeCode": "d580644744cd40ddbdf88ad5a5125613" }' ``` -------------------------------- ### PowerShell API Request Example Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Example of a POST request using curl.exe in PowerShell. Use the --% stop-parsing symbol to prevent PowerShell from incorrectly escaping special characters. ```powershell curl.exe --% --location "https://open-eu.uat.xpeng.com/open/oauth2/queryData?appId=YOUR_APP_ID&nonce=1787020880806&sign=YOUR_SIGN" ` --header "Content-Type: application/json" ` --data '{"openId":"6c6d6091390ffb38e70935b31397e0672e3e8cd8","accessToken":"eyJ...","enterpriseName":"XXXX Enterprise Name","scopeCode":"d580644744cd40ddbdf88ad5a5125613"}' ``` -------------------------------- ### Request Body Example for /oauth2/queryData Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html This JSON object represents the required body parameters for the POST request, including the openId, accessToken, enterpriseName, and scopeCode obtained during the authorization process. ```json { "openId": "6c6d6091390ffb38e70935b31397e0672e3e8cd8", "accessToken": "eyJ0eXBlIjoxLCJ2ZXJzaW9uIjoiMS4wLjAiLCJhbGciOiJIUzI1NiJ9...", "enterpriseName": "XXXX Enterprise Name", "scopeCode": "d580644744cd40ddbdf88ad5a5125613" } ``` -------------------------------- ### Signature String Construction for /oauth2/queryData Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Shows the resulting StringA, StringB, and final sign calculation based on the provided input variables. ```text StringA = body{"openId":"xxx","accessToken":"yyy","enterpriseName":"XXXX Enterprise Name","scopeCode":"abc"}nonce1787020880806 StringB = APPIDbody{"openId":"xxx","accessToken":"yyy","enterpriseName":"XXXX Enterprise Name","scopeCode":"abc"}nonce1787020880806APPSECRET sign = SHA1(StringB).toLowerCase() ``` -------------------------------- ### Signature Calculation Rules Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Details on how to construct the signature string and calculate the SHA1 hash for API requests. ```APIDOC ## Signature Calculation ### Description All requests must include a `sign` parameter calculated using the following steps: 1. **Build stringA**: Exclude `appId` and `sign` from query parameters. Add the request body as a field with key `"body"`. Sort all keys (including `body`) in natural ascending order and concatenate as `key1+value1+key2+value2`. 2. **Build stringB**: Prepend `appId` and append `appSecret` to `stringA`. 3. **Calculate sign**: Compute the SHA1 hash of `stringB` and convert the result to lowercase. ### Example (stringB construction) `stringB = ${appId} + stringA + ${appSecret}` ### Example (sign calculation) `sign = SHA1(stringB).toLowerCase()` ``` -------------------------------- ### Signature Generation for /oauth2/authorize Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Demonstrates the concatenation rules for building StringA, StringB, and the final SHA1 signature for the authorize endpoint. ```text GET https://xxx.xpeng.com/open/oauth2/authorize?appId=APPID&nonce=NONCE&state=STATE&sign=SIGN StringA = bodynonceNONCEstateSTATE StringB = APPIDbodynonceNONCEstateSTATEAPPSECRET sign = SHA1(StringB).toLowerCase() ``` -------------------------------- ### Signature Generation Inputs for /oauth2/queryData Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Provides the initial variable values required to build the signature strings for the queryData endpoint. ```text appId = APPID appSecret = APPSECRET nonce = 1787020880806 body = {"openId":"xxx","accessToken":"yyy","enterpriseName":"XXXX Enterprise Name","scopeCode":"abc"} ``` -------------------------------- ### POST /oauth2/queryData Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Submits a vehicle data download task or queries the status of an existing task based on the provided authorization credentials. ```APIDOC ## POST /oauth2/queryData ### Description This endpoint is used to submit a data download task or query the status of a previously submitted task. The first call initiates the task, while subsequent calls return the status or download URL. ### Method POST ### Endpoint https://open.xpeng.com/open/oauth2/queryData ### Parameters #### Query Parameters - **appId** (String) - Required - Application unique identifier. - **nonce** (String) - Required - Timestamp in milliseconds. - **sign** (String) - Required - Request signature. #### Request Body - **openId** (String) - Required - Obtained by the authorized user. - **accessToken** (String) - Required - Obtained by the authorized user. - **enterpriseName** (String) - Required - Obtained by the authorized user. - **scopeCode** (String) - Required - Obtained by the authorized user. ### Request Example { "openId": "6c6d6091390ffb38e70935b31397e0672e3e8cd8", "accessToken": "eyJ0eXBlIjoxLCJ2ZXJzaW9uIjoiMS4wLjAiLCJhbGciOiJIUzI1NiJ9...", "enterpriseName": "XXXX Enterprise Name", "scopeCode": "d580644744cd40ddbdf88ad5a5125613" } ``` -------------------------------- ### POST /open/oauth2/queryData Source: https://static-eu.xiaopeng.com/xp-ucenter/api-integration-guide-en-0.0.1.html Queries data using OAuth2 authentication. This endpoint requires an appId, nonce, and signature in the query parameters, with a JSON body containing the openId, accessToken, enterpriseName, and scopeCode. ```APIDOC ## POST /open/oauth2/queryData ### Description Queries data using OAuth2 authentication. ### Method POST ### Endpoint https://open-eu.uat.xpeng.com/open/oauth2/queryData ### Parameters #### Query Parameters - **appId** (string) - Required - The application identifier. - **nonce** (string) - Required - A unique random string for the request. - **sign** (string) - Required - The request signature. #### Request Body - **openId** (string) - Required - The user's open identifier. - **accessToken** (string) - Required - The OAuth2 access token. - **enterpriseName** (string) - Required - The name of the enterprise. - **scopeCode** (string) - Required - The scope code for the requested data. ### Request Example { "openId": "6c6d6091390ffb38e70935b31397e0672e3e8cd8", "accessToken": "eyJ0eXBlIjoxLCJ2ZXJzaW9uIjoiMS4wLjAiLCJhbGciOiJIUzI1NiJ9...", "enterpriseName": "XXXX Enterprise Name", "scopeCode": "d580644744cd40ddbdf88ad5a5125613" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.