# Long information to short chain

Debugging Tools

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 NametypeRequired to fill inIntroductions
access_tokenstringyesInterface invoke credentials, using access_token

# Request BodyRequest Payload

Parameter NametypeRequired to fill inIntroductions
long_datastringyesLong information that needs to be converted, no more than 4 KB
expire_secondsnumberyesExpiration seconds, maximum value 2592000 (30 days), default 2592000

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message
short_keystringShort 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 codeError DescriptionSolutions
-1A system error
40001invalid credential  access_token isinvalid or not latestAppSecret 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
44002empty post dataThe POST number is empty. The post request body parameter cannot be empty.
47001data format errorError 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
47003Parameter ErrorNo long_data passed in
9410010Long_data length exceeds limitStorage content over time limit (4 KB)
9410011Expire_seconds Limit exceededStorage 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.