# Long information to short chain
Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide
Interface name: genShortKey
Short key hosting is similar to short chain API, developers can not exceed 4KB of long information into short key through GenShorten, and then through FetchShorten to restore the short key to long information.
# 1. How to call
# HTTPS calls
POST https://api.weixin.qq.com/cgi-bin/shorten/gen?access_token=ACCESS_TOKEN
# Cloud Calls
Call method: officialAccount.shorten.gen
The input and exit parameters are the same as the HTTPS call, which can be called in the cloud call documentation
# Third party invocation
- Third Party Platform calls are not supported by this interface.
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
access_token | string | yes | Interface invoke credentials, using access_token |
# Request BodyRequest Payload
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
long_data | string | yes | Long information that needs to be converted, no more than 4 KB |
expire_seconds | number | yes | Expiration seconds, maximum value 2592000 (30 days), default 2592000 |
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
short_key | string | Short key, 15 bytes, base62 encoding (0-9 / a-z / A-Z) |
# 4. Note
There are no special considerations for this interface
# 5. Code examples
Example Requests
{
"long_data": "loooooong data",
"expire_seconds": 86400
}
Return an example
{
"errcode": 0,
"errmsg": "ok",
"short_key": "iTqRJFSEqk9RvPk"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
-1 | A system error | |
40001 | invalid credential access_token isinvalid or not latest | AppSecret error while getting access_token, or access_token is invalid.Developers should check that AppSecret is correct, or that they are calling interfaces for the appropriate Official Account |
44002 | empty post data | The POST number is empty. The post request body parameter cannot be empty. |
47001 | data format error | Error parsing JSON / XML content; Missing parameters in post data; The parameters need to be written as a JSON character string in the body of the post request, please check the correction and try again |
47003 | Parameter Error | No long_data passed in |
9410010 | Long_data length exceeds limit | Storage content over time limit (4 KB) |
9410011 | Expire_seconds Limit exceeded | Storage time exceeds limit (30 days) |
# 7. Scope of application
The interface has not yet clarified the types of account numbers that can be invoked, or determined whether they can be invoking based on the invoking reference in the business, provided that the actual call is already made.