### Get Kf Session List Request Example
Source: https://developers.weixin.qq.com/doc/service/api/customer/messctrl/api_getkfsessionlist
Example of a GET request to the getkfsessionlist API. Replace ACCESS_TOKEN and KFACCOUNT with your actual values.
```HTTP
https://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
```
--------------------------------
### Response Example
Source: https://developers.weixin.qq.com/doc/service/api/notify/template/api_getindustry.html
This is an example of a successful response from the Get Industry API, showing the primary and secondary industry details.
```json
{
"primary_industry": {
"first_class": "运输与仓储",
"second_class": "快递"
},
"secondary_industry": {
"first_class": "IT科技",
"second_class": "互联网|电子商务"
}
}
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/notify/notify/api_getpubnewtemplatekeywords.html
Example of an HTTPS GET request to fetch keywords, demonstrating the expected URL structure with a sample template ID.
```HTTP
https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=ACCESS_TOKEN&tid=99
```
--------------------------------
### HTTPS Call Example
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/userinfo/api_userinfo.html
This is an example of how to make an HTTPS GET request to retrieve user information. Ensure you replace ACCESS_TOKEN and the provided openid with actual values.
```http
GET https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=o6_bmjrPTlm6_2sgVt7hMZOPfL2M&lang=zh_CN
```
--------------------------------
### Get Video Material Response Example
Source: https://developers.weixin.qq.com/doc/service/api/material/permanent/api_getmaterial
This is an example of the response structure when successfully retrieving video material. It includes the video's title, description, and download URL.
```json
{
"title":TITLE,
"description":DESCRIPTION,
"down_url":DOWN_URL,
}
```
--------------------------------
### Curl Request Example for Temporary Media
Source: https://developers.weixin.qq.com/doc/service/api/material/temporary/api_getmedia
This example demonstrates how to make a GET request using curl to download temporary media. It includes the necessary access token and media ID.
```curl
curl -I -G "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID"
```
--------------------------------
### Get News Material Response Example
Source: https://developers.weixin.qq.com/doc/service/api/material/permanent/api_getmaterial
This is an example of the response structure when successfully retrieving news material. It includes details like title, author, and content.
```json
{
"news_item": [
{
"title": "TITLE",
"thumb_media_id": "THUMB_MEDIA_ID",
"show_cover_pic": 1,
"author": "AUTHOR",
"digest": "DIGEST",
"content": "CONTENT",
"url": "URL",
"content_source_url": "CONTENT_SOURCE_URL"
}
]
}
```
--------------------------------
### Example Response for Get Existing Template List
Source: https://developers.weixin.qq.com/doc/service/api/notify/notify/api_getwxapubnewtemplate.html
This is an example of the JSON response you can expect when successfully retrieving the list of templates. It includes details like template ID, title, content, and type.
```JSON
{
"errcode": 0,
"errmsg": "ok",
"data": [
{
"priTmplId": "9Aw5ZV1j9xdWTFEkqCpZ7mIBbSC34khK55OtzUPl0rU",
"title": "报名结果通知",
"content": "会议时间:{{date2.DATA}}\n会议地点:{{thing1.DATA}}\n",
"example": "会议时间:2016年8月8日\n会议地点:TIT会议室\n",
"type": 2
},
{
"priTmplId": "cy_DfOZL7lypxHh3ja3DyAUbn1GYQRGwezuy5LBTFME",
"title": "洗衣机故障提醒",
"content": "完成时间:{{time1.DATA}}\n所在位置:{{enum_string2.DATA}}\n提示说明:{{enum_string3.DATA}}\n",
"example": "完成时间:2021年10月21日 12:00:00\n所在位置:客厅\n提示说明:设备发生故障,导致工作异常,请及时查看\n",
"keywordEnumValueList": [
{
"enumValueList": [
"客厅",
"餐厅",
"厨房",
"卧室",
"主卧",
"次卧",
"客卧",
"父母房",
"儿童房",
"男孩房",
"女孩房",
"卫生间",
"主卧卫生间",
"公共卫生间",
"衣帽间",
"书房",
"游戏室",
"阳台",
"地下室",
"储物间",
"车库",
"保姆房",
"其他房间"
],
"keywordCode": "enum_string2.DATA"
},
{
"enumValueList": [
"设备发生故障,导致工作异常,请及时查看"
],
"keywordCode": "enum_string3.DATA"
}
],
"type": 3
}
]
}
```
--------------------------------
### Initial Request for Followers List
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/userinfo/api_getfans
Example of an initial request to fetch the first batch of followers. The `access_token` is required. If `next_openid` is omitted, the list starts from the beginning.
```http
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN
```
--------------------------------
### Add Video Material Example
Source: https://developers.weixin.qq.com/doc/service/api/material/permanent/api_addmaterial.html
Use this example to upload a video material. The 'media' parameter should be a file upload, and the 'description' parameter is a JSON object containing the video's title and introduction.
```bash
curl "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE" -F media=@media.file -F description='{"title":VIDEO_TITLE, "introduction":INTRODUCTION}'
```
```json
{
"media_id": "MEDIA_ID_123456",
"url": ""
}
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/notify/notify/api_getpubnewtemplatetitles.html
Demonstrates the structure of an HTTPS GET request to retrieve public template titles. Ensure you replace placeholders like ACCESS_TOKEN, IDS, START, and LIMIT with actual values.
```http
GET https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN&ids=IDS&start=START&limit=LIMIT
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/notify/template/api_getindustry.html
This is an example of an HTTPS GET request to the Get Industry API. Replace ACCESS_TOKEN with a valid access token.
```http
GET https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN
```
--------------------------------
### 使用wx-open-launch-weapp跳转小程序
Source: https://developers.weixin.qq.com/doc/service/guide/h5/opentag
使用wx-open-launch-weapp标签提供一个可跳转指定小程序的按钮。用户需在网页内点击标签按钮方可跳转小程序。支持通过事件监听跳转成功或失败。
```html
```
--------------------------------
### Add Image Material Example
Source: https://developers.weixin.qq.com/doc/service/api/material/permanent/api_addmaterial.html
This example demonstrates how to upload an image material. It requires the 'media' parameter for the file upload. The 'description' parameter is optional for images.
```bash
curl "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE" -F media=@media.file
```
```json
{
"media_id": "MEDIA_ID_654321",
"url": "https://example.com/image.jpg"
}
```
--------------------------------
### Non-Tax Get Order Request Example
Source: https://developers.weixin.qq.com/doc/service/api/nontaxpay/api_nontaxgetorder.html
This is an example of a request payload for the Non-Tax Get Order API. Ensure you provide the correct 'appid' and 'order_id'.
```json
{
"appid": "wx5f6e43071809a9dd",
"order_id": "AQCAGxwqp6-aBeIKDJ7fvb6x3dZt"
}
```
--------------------------------
### Response Example
Source: https://developers.weixin.qq.com/doc/service/api/stores/miniapp/api_getwxastoreauditinfo.html
This example shows a successful response from the `getwxastoreauditinfo` API, including the audit ID, status, and reason (if applicable).
```json
{
"errcode":0,
"errmsg":"ok",
"data": {
"audit_id": 414569513,
"status": 1,
"reason": ""
}
}
```
--------------------------------
### Non-Tax Get Order Response Example
Source: https://developers.weixin.qq.com/doc/service/api/nontaxpay/api_nontaxgetorder.html
This is an example of a successful response from the Non-Tax Get Order API. It includes detailed information about the order status, payment, and notification history.
```json
{
"errcode": 0,
"errmsg": "ok",
"appid": "wx5f6e43071809a9dd",
"openid": "ont-9vjAcIdSU-LgB7ubALAVJO9U",
"order_id": "AQCAGxwqp6-aBeIKDJ7fvb6x3dZt",
"create_time": 1508847678,
"pay_finish_time": 0,
"desc": "测试办证缴费",
"fee": 1,
"fee_type": 1,
"trans_id": "",
"status": 12,
"bank_id": "test_bank_id",
"bank_name": "测试_银行",
"bank_account": "6215385809487657",
"refund_finish_time": 0,
"items": [
{
"no": 1,
"item_id": "000001",
"item_name": "测试办证缴费1",
"overdue": 0,
"fee": 1
},
{
"no": 2,
"item_id": "000002",
"item_name": "测试办证缴费2",
"overdue": 0,
"fee": 0
}
],
"bill_type_code": "",
"bill_no": "",
"payment_info_source": 2,
"payment_notice_no": "08111639088",
"department_code": "118610002",
"department_name": "测试执收单位",
"payment_notice_type": 1,
"region_code": "440000",
"notify_history": [
{
"appid": "wx5f6e43071809a9dd",
"name": "测试财政",
"notify_detail": [
{
"notify_time": 1524023367,
"ret": 0,
"cost_time": 39,
"wxnontaxstr": "2ba37f90d155d390",
"status": 3,
"errcode": 0,
"errmsg": ""
}
],
"notify_cnt": 1
},
{
"appid": "wxefd0818f53b9b82f",
"name": "测试委办局",
"notify_detail": [
{
"notify_time": 1524023367,
"ret": 0,
"cost_time": 20,
"wxnontaxstr": "f7ad824e08ac4bc5",
"status": 3,
"errcode": 0,
"errmsg": ""
}
],
"notify_cnt": 1
},
{
"appid": "wxf1bfa94c33668abf",
"name": "测试银行",
"notify_detail": [
{
"notify_time": 1524023367,
"ret": 0,
"cost_time": 18,
"wxnontaxstr": "2e628b6f1e3e9bf3",
"status": 3,
"errcode": 0,
"errmsg": ""
}
],
"notify_cnt": 1
}
]
}
```
--------------------------------
### 鸿蒙: module.json5 - 配置action
Source: https://developers.weixin.qq.com/doc/service/guide/h5/opentag
在App module的 `src/main/module.json5` 文件中,为入口ability配置`wxentity.action.open` action,以便微信拉起App时能被正确识别。
```json
{
"module": {
"type": "entry",
"abilities": [
{
"name": "DemoEntryAbility",
"srcEntry": "./ets/entryability/DemoEntryAbility.ets",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home",
"wxentity.action.open" // 微信拉起App时会用该action, 需接入方配置
]
}
]
}
]
}
}
```
--------------------------------
### 处理JS-SDK配置成功验证
Source: https://developers.weixin.qq.com/doc/service/guide/h5/opentag
在wx.config信息验证成功后执行ready方法,所有接口调用都必须在config接口获得结果之后。对于用户触发时才调用的接口,则可以直接调用。
```javascript
wx.ready(function () {
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中
});
```
--------------------------------
### Batch Get Gift Card Orders Request Example
Source: https://developers.weixin.qq.com/doc/service/guide/product/card/gift_card.html
This is an example of the JSON payload for the batch get gift card orders API request. Ensure `access_token` is provided in the URL.
```json
{
"begin_time": 1472400000,
"end_time": 1472716604,
"sort_type": "ASC",
"offset": 0,
"count": 2
}
```
--------------------------------
### Start Recording
Source: https://developers.weixin.qq.com/doc/service/guide/h5/jssdk
Initiates audio recording.
```APIDOC
## wx.startRecord
### Description
Initiates audio recording.
### Method
`wx.startRecord()`
### Parameters
None
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/userinfo/api_getblacklist.html
This is an example of an HTTPS request to the Get Blacklist API. Ensure you replace ACCESS_TOKEN with a valid token.
```http
POST https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist?access_token=ACCESS_TOKEN
```
--------------------------------
### API Set Menu Example
Source: https://developers.weixin.qq.com/doc/service/api/custommenu/api_getcurrentselfmenuinfo.html
Provides an example of how to set the custom menu for an official account using the API. This includes different button types like 'click' and 'view' with associated keys or URLs.
```APIDOC
## POST /cgi-bin/modify_menu
### Description
Sets or modifies the custom menu for an official account.
### Method
POST
### Endpoint
/cgi-bin/modify_menu
### Request Body
- **is_menu_open** (integer) - Required. Indicates if the menu should be open (1) or closed (0).
- **selfmenu_info** (object) - Required. Contains the menu structure.
- **button** (array) - Required. An array of menu buttons.
- **name** (string) - Required. The name of the button.
- **type** (string) - Required. The type of the button ('click', 'view', 'scancode_push', 'scancode_waitmsg', 'pic_sysphoto', 'pic_photo_or_album', 'pic_weixin', 'location_select', 'media_id', 'view_limited').
- **key** (string) - (Optional) Required for 'click' type buttons. The key associated with the button.
- **url** (string) - (Optional) Required for 'view' type buttons. The URL the button links to.
- **sub_button** (object) - (Optional) Contains sub-buttons for parent buttons.
- **list** (array) - Required if `sub_button` is present. An array of sub-menu items.
- **type** (string) - Required. The type of the sub-menu item.
- **name** (string) - Required. The name of the sub-menu item.
- **key** (string) - (Optional) Required for 'click' type sub-menu items.
- **url** (string) - (Optional) Required for 'view' type sub-menu items.
### Request Example
```json
{
"is_menu_open": 1,
"selfmenu_info": {
"button": [
{
"type": "click",
"name": "今日歌曲",
"key": "V1001_TODAY_MUSIC"
},
{
"name": "菜单",
"sub_button": {
"list": [
{
"type": "view",
"name": "搜索",
"url": "http://www.soso.com/"
},
{
"type": "view",
"name": "视频",
"url": "http://v.qq.com/"
},
{
"type": "click",
"name": "赞一下我们",
"key": "V1001_GOOD"
}
]
}
}
]
}
}
```
### Response
#### Success Response (200)
An empty JSON object `{}` is returned upon successful modification.
#### Error Handling
Refer to the 'Error Codes' section for potential issues and their solutions.
```
--------------------------------
### Request Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/wedata/news/api_getarticlesummary.html
Example of the JSON payload required for the Get Article Summary API request, specifying the date range.
```json
{
"begin_date": "2014-12-08",
"end_date": "2014-12-08"
}
```
--------------------------------
### Nginx Configuration Example
Source: https://developers.weixin.qq.com/doc/service/guide/dev/api/warn_guide.html
This snippet provides example Nginx configurations relevant to handling connections and logging, which can be crucial for troubleshooting connection timeouts and request handling issues. It includes settings for worker processes, error logs, file descriptors, and connection limits.
```nginx
worker_processes 16; //CPU核数
error_log logs/error.log info; //错误日志log
worker_rlimit_nofile 102400; //打开最大句柄数
events {
worker_connections 102400; //允许最大连接数
}
//请求日志记录,关键字段:request_time-请求总时间,upstream_response_time后端处理时 间
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$host" "$cookie_ssl_edition" '
'"$upstream_addr" "$upstream_status" "$request_time" '
'"$upstream_response_time" ';
access_log logs/access.log main;
```
--------------------------------
### Create Custom Menu with Click and View Buttons
Source: https://developers.weixin.qq.com/doc/service/api/custommenu/api_createcustommenu.html
This example demonstrates creating a custom menu with 'click' and 'view' type buttons, including nested sub-buttons. Ensure the button names and keys are valid.
```json
{
"button":[
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
"sub_button":[
{
"type":"view",
"name":"搜索",
"url":"http://www.soso.com/"
},
{
"type":"miniprogram",
"name":"wxa",
"url":"http://mp.weixin.qq.com",
"appid":"wx286b93c14bbf93aa",
"pagepath":"pages/lunar/index"
},
{
"type":"click",
"name":"赞一下我们",
"key":"V1001_GOOD"
}]
}]
}
```
--------------------------------
### Get Draft Count - Response Example
Source: https://developers.weixin.qq.com/doc/service/api/draftbox/draftmanage/api_draft_count.html
Example of a successful response from the draft count API, indicating the total number of drafts.
```json
{
"total_count": 15
}
```
--------------------------------
### API Menu Configuration Example
Source: https://developers.weixin.qq.com/doc/service/api/custommenu/api_getcurrentselfmenuinfo.html
This example demonstrates the JSON structure for a self-defined menu configured via the API. It includes 'click' type buttons with keys and 'view' type buttons with URLs.
```json
{}
```
```json
{
"is_menu_open": 1,
"selfmenu_info": {
"button": [
{
"type": "click",
"name": "今日歌曲",
"key": "V1001_TODAY_MUSIC"
},
{
"name": "菜单",
"sub_button": {
"list": [
{
"type": "view",
"name": "搜索",
"url": "http://www.soso.com/"
},
{
"type": "view",
"name": "视频",
"url": "http://v.qq.com/"
},
{
"type": "click",
"name": "赞一下我们",
"key": "V1001_GOOD"
}
]
}
}
]
}
}
```
--------------------------------
### Get Draft Count - Request Example
Source: https://developers.weixin.qq.com/doc/service/api/draftbox/draftmanage/api_draft_count.html
Example of a request to the draft count API. This endpoint only returns the count and not the draft content.
```http
https://api.weixin.qq.com/cgi-bin/draft/count
```
--------------------------------
### Response Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/wedata/news/api_getarticlesummary.html
Example of a successful response from the Get Article Summary API, showing article reading data for a specific date.
```json
{
"list": [
{
"ref_date": "2014-12-08",
"msgid": "10000050_1",
"title": "12月27日 DiLi日报",
"int_page_read_user": 23676,
"int_page_read_count": 25615,
"ori_page_read_count": 34,
"share_user": 122,
"share_count": 994,
"add_to_fav_user": 1
}
]
}
```
--------------------------------
### Request Example URL
Source: https://developers.weixin.qq.com/doc/service/api/openpoc/ai/api_addvoicetorecofortext.html
An example of the request URL for the addVoiceTorecoForText API. Note that the format parameter is empty in this example, which might lead to errors if not handled correctly.
```http
https://api.weixin.qq.com/cgi-bin/media/voice/addvoicetorecofortext?access_token=ACCESS_TOKEN&format=&voice_id=xxxxxx&lang=zh_CN
```
--------------------------------
### Click and View Button Example
Source: https://developers.weixin.qq.com/doc/service/api/custommenu/api_createcustommenu.html
Example of creating a custom menu with 'click' and 'view' type buttons. The 'click' type triggers an event with a key, while the 'view' type navigates to a URL.
```APIDOC
## Create Custom Menu with Click and View Buttons
### Description
This section demonstrates how to create a custom menu using 'click' and 'view' button types. 'Click' buttons are associated with a key for event triggering, and 'view' buttons navigate users to a specified URL.
### Method
POST
### Endpoint
/cgi-bin/menu/create (This is a hypothetical endpoint based on common API patterns, as the source does not specify the HTTP method or full endpoint.)
### Request Body
- **button** (Array) - Required - A list of buttons to be included in the menu.
- **type** (String) - Required - The type of the button ('click' or 'view').
- **name** (String) - Required - The name of the button displayed to the user.
- **key** (String) - Required for 'click' type - The key associated with the click event.
- **url** (String) - Required for 'view' type - The URL the button navigates to.
- **sub_button** (Array) - Optional - A list of sub-buttons for creating nested menus.
### Request Example
```json
{
"button": [
{
"type": "click",
"name": "今日歌曲",
"key": "V1001_TODAY_MUSIC"
},
{
"name": "菜单",
"sub_button": [
{
"type": "view",
"name": "搜索",
"url": "http://www.soso.com/"
},
{
"type": "miniprogram",
"name": "wxa",
"url": "http://mp.weixin.qq.com",
"appid": "wx286b93c14bbf93aa",
"pagepath": "pages/lunar/index"
},
{
"type": "click",
"name": "赞一下我们",
"key": "V1001_GOOD"
}
]
}
]
}
```
### Response
#### Success Response (200)
- **errcode** (Integer) - Error code, 0 for success.
- **errmsg** (String) - Error message, 'ok' for success.
#### Response Example
```json
{
"errcode": 0,
"errmsg": "ok"
}
```
```
--------------------------------
### Request Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/wedata/news/api_getusershare.html
Example JSON payload for the Get User Share API request, specifying the date range for data retrieval.
```JSON
{
"begin_date": "2014-12-08",
"end_date": "2014-12-08"
}
```
--------------------------------
### Official Website Menu Configuration Example
Source: https://developers.weixin.qq.com/doc/service/api/custommenu/api_getcurrentselfmenuinfo.html
This example shows the JSON structure for a self-defined menu configured via the official website. It includes various button types like view, news, video, and voice.
```json
{}
```
```json
{
"is_menu_open": 1,
"selfmenu_info": {
"button": [
{
"name": "button",
"sub_button": {
"list": [
{
"type": "view",
"name": "view_url",
"url": "http://www.qq.com"
},
{
"type": "news",
"name": "news",
"value":"KQb_w_Tiz-nSdVLoTV35Psmty8hGBulGhEdbb9SKs-o",
"news_info": {
"list": [
{
"title": "MULTI_NEWS",
"author": "JIMZHENG",
"digest": "text",
"show_cover": 0,
"cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLvhTcm9sDA/0",
"content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd",
"source_url": ""
},
{
"title": "MULTI_NEWS1",
"author": "JIMZHENG",
"digest": "MULTI_NEWS1",
"show_cover": 1,
"cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKnmnpXYgWmQD5gXUrEApIYBCgvh2yHsu3ic3anDUGtUCHwjiaEC5bicd7A/0",
"content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=2&sn=8226843afb14ecdecb08d9ce46bc1d37#rd",
"source_url": ""
}
]
}
},
{
"type": "video",
"name": "video",
"value": "http://61.182.130.30/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=77A42D0C2015FBB0A3653D29C571B5F4BBF1D243FBEF17F09C24FF1F2F22E30881BD350E360BC53F&sha=0&save=1"
},
{
"type": "voice",
"name": "voice",
"value": "nTXe3aghlQ4XYHa0AQPWiQQbFW9RVtaYTLPC1PCQx11qc9UB6CiUPFjdkeEtJicn"
}
]
}
},
{
"type": "text",
"name": "text",
"value": "This is text!"
},
{
"type": "img",
"name": "photo",
"value": "ax5Whs5dsoomJLEppAvftBUuH7CgXCZGFbFJifmbUjnQk_ierMHY99Y5d2Cv14RD"
}
]
}
}
```
--------------------------------
### Response Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/tag/api_gettagidlist
Example of a successful response from the Get User Tag List API, showing the user's tag IDs.
```json
{
"tagid_list":[134, 2]
}
```
--------------------------------
### Instance Methods
Source: https://developers.weixin.qq.com/doc/service/guide/h5/opentag
Methods available on the wx-open-audio component instance to control audio playback.
```APIDOC
## Instance Methods
### Description
Methods available on the `wx-open-audio` component instance to control audio playback.
### Methods
- **load()**: Reloads the audio.
- **play()**: Plays the audio. For user experience, this can only be called after the user's first click triggers playback.
- **pause()**: Pauses the audio playback.
### Example
```javascript
//
const audio = document.getElementById('audio');
audio.load();
audio.play();
audio.pause();
```
```
--------------------------------
### Driving OCR Cloud Function Example (Node.js)
Source: https://developers.weixin.qq.com/doc/service/api/openpoc/ocr/api_drivingocr.html
This Node.js example demonstrates how to use the wx-server-sdk to call the Driving OCR API within a cloud function. It requires initialization with the environment and uses the `vehicleLicense` method.
```javascript
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.ocr.vehicleLicense({
"type": 'photo',
"imgUrl": 'ENCODE_URL'
})
return result
} catch (err) {
return err
}
}
```
--------------------------------
### Request Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/tag/api_gettagidlist
Example of the JSON payload required for the Get User Tag List API request, including the user's openid.
```json
{
"openid" : "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"
}
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/stores/miniapp/api_getdistrictlist.html
This is an example of how to make an HTTPS GET request to the getdistrictlist API. Ensure you include a valid access token in the query parameters.
```http
GET https://api.weixin.qq.com/wxa/get_district?access_token=ACCESS_TOKEN
```
--------------------------------
### Request Example URL
Source: https://developers.weixin.qq.com/doc/service/api/notify/notify/api_getpubnewtemplatetitles.html
An example URL for making a request to the getPubNewTemplatetitles API, including sample values for query parameters.
```http
https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN&ids="2,616"&start=0&limit=1
```
--------------------------------
### Get Kf Session List Response Example
Source: https://developers.weixin.qq.com/doc/service/api/customer/messctrl/api_getkfsessionlist
Example JSON response structure for the getkfsessionlist API, showing the sessionlist array with session details.
```JSON
{
"sessionlist": [
{
"createtime": 123456789,
"openid": "OPENID"
}
]
}
```
--------------------------------
### Request Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/wedata/mess/api_getupstreammsg
An example of the JSON payload required for the Get Upstream Message API request. Specify the begin_date and end_date for the desired data range.
```json
{
"begin_date": "2014-12-07",
"end_date": "2014-12-08"
}
```
--------------------------------
### 配置开放标签权限
Source: https://developers.weixin.qq.com/doc/service/guide/h5/opentag
通过wx.config接口注入权限验证配置并申请所需的开放标签。同一个url仅需调用一次,开放标签的申请和JS接口的申请相互独立。
```javascript
wx.config({
debug: true,
appId: '',
timestamp: ,
nonceStr: '',
signature: '',
jsApiList: [],
openTagList: []
});
```
--------------------------------
### 修改Web应用以处理微信请求 (Python)
Source: https://developers.weixin.qq.com/doc/service/guide/dev/start
修改原有的main.py文件,引入handle.py文件,以处理微信公众号的URL验证和消息交互。此代码用于验证Token。
```python
# -*- coding: utf-8 -*-
# filename: main.py
import web
from handle import Handle
urls = (
'/wx', 'Handle',
)
if __name__ == '__main__':
app = web.application(urls, globals())
app.run()
```
--------------------------------
### HTTPS Request Example
Source: https://developers.weixin.qq.com/doc/service/api/notify/notify/api_getcategory
This example demonstrates how to make an HTTPS GET request to the getCategory API endpoint. Ensure you replace `ACCESS_TOKEN` with a valid access token.
```http
GET https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=ACCESS_TOKEN
```
--------------------------------
### Response Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/invoice/FiscalReceipt/api_invoiceplatformgetpdf.html
Example of a successful response from the Get PDF API. It includes the PDF URL, its expiration time, and standard API response fields.
```json
{
"errcode": 0,
"errmsg": "ok",
"pdf_url": "https://mp.weixin.qq.com/intp/invoice/getpdf?action=media_pdf&media_key=dFRnTkV6WCswNjB1V1czZ0tVU3MhaX4yb2pxeEVSY0teSCtuflY6UXAifD5rL09kTjFpOFVWKyJGNCgxTCtkJER6VjFlRCtVU2JKcS5FZw",
"pdf_url_expire_time": 7200
}
```
--------------------------------
### Response Payload Example
Source: https://developers.weixin.qq.com/doc/service/api/wedata/mess/api_getupstreammsg
An example of the JSON response structure returned by the Get Upstream Message API. It includes a list of message statistics for the specified date range.
```json
{
"list": [
{
"ref_date": "2014-12-07",
"msg_type": 1,
"msg_user": 282,
"msg_count": 817
}
]
}
```
--------------------------------
### Response Example for Wait Case List
Source: https://developers.weixin.qq.com/doc/service/api/customer/messctrl/api_getwaitcase.html
This example shows the structure of a successful response, including the count of unassigned sessions and a list of session details.
```JSON
{
"count": 150,
"waitcaselist": [
{
"latest_time": 123456789,
"openid": "OPENID"
}
]
}
```
--------------------------------
### Get Tags API Response Example
Source: https://developers.weixin.qq.com/doc/service/api/usermanage/tag/api_gettags
This example demonstrates the structure of the response when successfully retrieving tags. It includes tag ID, name, and the count of followers in each tag.
```json
{
"tags": [
{
"id": 1,
"name": "每天一罐可乐星人",
"count": 0
},
{
"id": 2,
"name": "星标组",
"count": 0
}
]
}
```