This is the 30th day of my participation in the August Text Challenge.More challenges in August

Get the QR code

We recommend generating and using small code, which is more recognizable. There are currently two interfaces that can generate applets, and developers can choose the appropriate interface according to their own needs.

Interface A: Applies to service scenarios that require A small number of codes

The interface address: api.weixin.qq.com/wxa/getwxac…

POST Parameter Description

parameter type The default value instructions
path String The value cannot be empty and contains a maximum of 128 bytes
width Int 430 Width of qr code
auto_color Bool false Automatically configure the line color. If the color is still black, it is not recommended to configure the main color
line_color Object {“r”:”0″,”g”:”0″,”b”:”0″} {“r”:” XXX “,”g”:” XXX “,”b”:” XXX “}

Note: the small program code generated through this interface is always valid. Please use it with caution. After the user scans the code to enter the mini program, the page corresponding to path is directly displayed.

Interface B: Applicable to service scenarios where a large number of codes are required or only temporary

The interface address: api.weixin.qq.com/wxa/getwxac…

POST Parameter Description

parameter type The default value instructions
scene String The value contains a maximum of 32 visible characters, including digits, uppercase and lowercase characters, and some special characters:! # $& ‘() *, + / :; =? @-._~, other characters should be encoded as legitimate characters (Chinese characters cannot be processed by Urlencode because % is not supported, please use other encoding methods).
page String The page must be a published applet page, for example, “Pages /index/index”. If this field is left blank, the main page will be displayed by default
width Int 430 Width of qr code
auto_color Bool false Automatically configure the line color. If the color is still black, it is not recommended to configure the main color
line_color Object {“r”:”0″,”g”:”0″,”b”:”0″} If auto_color is false, use RGB to set the color e.g. {“r”:” XXX “,”g”:” XXX “,”b”:” XXX “}

Note: the small program code generated through this interface is valid forever, the number of temporary unlimited. After the user scans the code to enter the small program, the developer needs to obtain the value of scene field in the code on the corresponding page, and then do the processing logic. The following code can be used to obtain the value of scene field in the TWO-DIMENSIONAL code. In the debugging stage, the conditional compilation of the custom parameter scene= XXXX of the development tool can be used for simulation. The parameter value of scene in the simulation of the development tool needs to be urlencode

Get the applets QR code

Interface C: Applicable to service scenarios that require a small number of codes

Interface address: api.weixin.qq.com/cgi-bin/wxa…

POST Parameter Description

parameter type The default value instructions
path String The value cannot be empty and contains a maximum of 128 bytes
width Int 430 Width of qr code

Note: The small program QR code generated through this interface is permanent and valid. Please use it with caution. After the user scans the code to enter the mini program, the page corresponding to path is directly displayed.

Example:

{"path": "pages/index? query=1", "width": 430}Copy the code

Bug & Tip

  1. tip: Only the QR codes of published small programs can be generated through this interface.
  2. tip: Can generate the development version of the reference QR code during the developer tool preview.
  3. tip: The number of codes generated by interface A and interface C is limited to 100,000. Invoke the code with caution.
  4. tipThe: POST parameter must be converted to a JSON string. Form submission is not supported.
  5. tipThe: auto_color line_color parameter is valid only for small code.

Error code

45009: The call frequency of interface B is limited in minutes (currently 5000 times/minute, it will be adjusted). If a large number of small program codes are required, it is recommended to generate them in advance.

45029: The sum of generated codes of interface A and interface C reaches the upper limit.

41030: The page transmitted by interface B does not exist, or the applet has not been released. Please note that interface B does not have the path parameter. Although the path parameter can generate the applet code, it can only jump to the main page.