# Set QR Code Rules

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: qrcodeJumpAdd

This interface is used to add or modify Service Account two-dimensional code rules to Weixin Mini Program two-dimensional code rules

# 1. How to call

# HTTPS calls

POST https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpadd?access_token=ACCESS_TOKEN

# Cloud Calls

  • This interface does not support cloud calls

# Third party invocation

  • This interface supports Third Party Platform generation business call.

  • This interface belongs to the permission set id: 3, 18

  • When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inIntroductions
access_tokenstringyesInterface invocation credentials, using access_token , authorizer_access_token

# Request BodyRequest Payload

Parameter NametypeRequired to fill inExampleIntroductions
prefixstringyeshttp://weixin.qq.com/q/kZgfwMTm72WxxxxThe rule is that the URL with reference to Service Account must be the URL beginning with http://weixin.qq.com/q/, for examplehttp://weixin.qq.com/q/02P5KzM_xxxxx
appidstringyeswxxxxxxService Account AppID Weixin Mini Program
pathstringyespages/index/indexWeixin Mini Program Function page
is_editnumberyes0Edit the marker, 0 indicates the addition of QR code rules, and 1 indicates the modification of existing QR code regulations (note that already published rules do not support modification).

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message

# 4. Note

# Instructions for invoking

  • This interface is used to add or modify QR code rules. It applies to adding or modifying QR code Rules for "scan a normal QR code to open Weixin Mini Program" and for "scan the Service Account QR code to Open a Mini Program."
  • If you are adding or modifying the "sweep ordinary two-dimensional code to open Weixin Mini Program" two-dimensional code rule, the parameters areprefix、permit_sub_rule、path、open_version、debug_url、is_edit。
  • If you are adding or modifying a QR code rule that says "scan Service Account QR code to open Weixin Mini Program QR code," the parameters prefix, AppID, path, and is_edit are involved, as described in the documentation below.

# Service Account Call Dxplaination

  • In order to invoke this interface, the service provider must first obtain Service Account The permission set id of 3 must be authorized to the service provider, otherwise the 61007 error will occur.
  • Service Account The interface must be associated with Weixin Mini Program before it can be invoked. If a service number does not already associate a Mini Program, you can associate another Mini Program by using the linkMiniprogram interface, or at Official Account Administration Console - Advertising and Services - Small Program Management.

# 5. Code examples

# 5.1 Add or modify the code rule for "Scan ordinary code to open Weixin Mini Program"

Example Requests

{
  "prefix": "https://weixin.qq.com/qrcodejump",
  "permit_sub_rule": 1,
  "path": "pages/index/index",
  "open_version": 1,
  "debug_url": [
    "https://weixin.qq.com/qrcodejump?a=1",
    "https://weixin.qq.com/qrcodejump?a=2"
  ],
  "is_edit": 0
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok"
}

# 5.2 Add or modify the "sweep Service Account two-dimensional code to open Weixin Mini Program" two-dimensional code rule

Example Requests

{
  "prefix": "http://weixin.qq.com/q/kZgfwMTm72Wxxxx",
  "appid": “wxxxxxx”,
  "path": "pages/index/index",
  "is_edit": 0
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok"
}

# 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
-1The system is busy.Please try again.
0oksuccess
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
40097invalid argsThe published rules do not support changes
40166 invalid appidAppID Invalid parameters
44990Interface requests are too fastMore than 5 times / second
85066Link ErrorCheck the legitimacy of the links
85068test url is not the sub  prefixA test link is not a sublink
85069check confirm file failThe validation file failed
85070URL Hit BlacklistCould not be added
85071Link duplicatesDo not add repeatedly
85072Links are being occupiedCheck link affiliation
85073The number of rules is full.Exceeding the quantity limit
85075Personal Weixin Mini Program restrictionsUnable to set rules
85076 check ICP failCheck ICP Failure
886001The system is busy.Please try again.

# 7. Scope of application

This interface supports "Service Account (authentication only)" account type calls.None of the other account types can be invoked without special instructions.