Public Account Development Series-parameters related to enterprise ID Development
After the enterprise number came out, I also explored it with the experience of developing the subscription number and service number. Here I sorted out some interface parameters that I encountered when I re-developed the enterprise number. Enterprise development documentation see the http://qydev.weixin.qq.com/wiki/index.php? Title = Homepage
1. create custom menu parameters:
To create a menu, the official definition is as follows.
Request description
Https Request Method: POST
Https://qyapi.weixin.qq.com/cgi-bin/menu/create? Access_token = ACCESS_TOKEN & agentid = 1
The request package is as follows:
{"Button": [{"type": "click", "name": "Today's songs", "key": "V1001_TODAY_MUSIC" },{ "name ": "menu", "sub_button": [{"type": "view", "name": "Search", "url": "http://www.soso.com /"}, {"type": "click", "name": "like us", "key": "V1001_GOOD"}]}
Parameter description
Parameters |
Required |
Description |
Access_token |
Yes |
Interface call credential |
Agentid |
Yes |
The id of the enterprise application, an integer. You can view it on the application settings page. |
Button |
Yes |
Level 1 menu array. The number should be 1 ~ 3 |
Sub_button |
No |
List menu array, the number should be 1 ~ Five |
Type |
Yes |
Menu Response Action type. Currently, there are two types: click and view. |
Name |
Yes |
Menu title, no more than 16 bytes, and no more than 40 bytes |
Key |
The click type is required. |
Menu KEY value, used for message interface push, no more than 128 bytes |
Url |
View type is required |
Webpage links. Employees can click the menu to open the link, up to 256 bytes |
Permission description
The Administrator must have application management permissions and the application must be set in callback mode.
Returned results
{ "errcode":0, "errmsg":"ok"}
2. Download the encryption/Decryption Library
C # Library (updated on April 9, September 22, click to download)
Note:
1. The Cryptography. cs file encapsulates the AES encryption and decryption process, so you do not need to care about the specific implementation. The WXBizMsgCrypt. cs file provides three interfaces for users to access the enterprise. The Sample. cs file provides an example of how to use these three interfaces.
2. WXBizMsgCrypt. cs encapsulates VerifyURL, DecryptMsg, and EncryptMsg APIs for developers to verify the callback url, decrypt received messages, and encrypt developers' reply messages. For instructions, see the Sample. cs file.
3,Get AccessToken
The AccessToken is the globally unique ticket of the enterprise account. When calling an interface, you must carry the AccessToken.
The AccessToken must be replaced by the CorpID and Secret. Different Secret return different AccessToken.Under normal circumstances, the AccessToken is valid for 7200 seconds. The same results are returned and automatically renewed. Because the number of api calls to obtain access_token is very limited, we recommend that you store and update access_token globally. Refreshing access_token frequently will restrict api calls and affect your business..
Request description
Https Request Method: GET
Https://qyapi.weixin.qq.com/cgi-bin/gettoken? Corpid = id & Cortana cret = secrect
Parameter description
Parameters |
Required |
Description |
Corpid |
Yes |
Enterprise Id |
Cortana cret |
Yes |
Credential key of the Management Group |
Permission description
Each secret represents different permissions for applications, address books, and interfaces. Different management groups have different secret.
Return description
A) Correct Json return results:
{ "access_token": "accesstoken000001",}
Parameters |
Description |
Access_token |
Obtained credential |
B) Return example of invalid Json:
{ "errcode": 43003, "errmsg": "require https"}
If you need to use the interface for development, you also need to create a management group to obtain the corresponding development creden.
For the sake of Enterprise Information Protection, enterprise numbers do not provide development creden。 with "Super Permissions. Therefore, you need to create a management group and set the required operation permissions to obtain the corresponding parameters for obtaining access creden。: CorpID and Secret.
Notes for the latest enterprise ID
Note: Update to version 5.4 or above.
1. Update to version 5.4 or above.
2. Currently, only versions of iOS and Android platforms are supported.
My Sina Weibo: http://weibo.com/ I /1741159542