关于微信API:常用微信API文档整理

来源 : 99API发布 : 2019-07-02 09:29:13访问数 : 7点赞数 : 1

  微信公众平台消息接口为开发者提供了一种新的消息处理方式。微信公众平台消息接口为开发者提供与用户进行消息交互的能力。对于成功接入消息接口的微信公众账号,当用户发消息给公众号,微信公众平台服务器会使用HTTP请求对接入的网址进行消息推送,第三方服务器可通过响应包回复特定结构,从而达到回复消息的目的。本文内容就整理些常用的的微信开发API,可以了解下。

ee9f17b1d8394d72980ea0a51a369835.jpg

package cn.vision.weixindemo.utils.base.API;

 

public class WeiXin_API {

 

    //    授权类

    /**

     * 获取授权Token

     * https请求方式: GET

     *  字段      必填              备注

     * grant_type     获取access_token填写client_credential

     * appid          第三方用户唯一凭证

     * secret          第三方用户唯一凭证密钥,即appsecret

     *

     * by Vision

     */

    public static String API_GET_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";

 

//    菜单类

    /**

     * 创建菜单

     * http请求方式:POST(请使用https协议)

     * 字段             必填                             备注

     * button                                      一级菜单数组,个数应为1~3

     * sub_button                                  二级菜单数组,个数应为1~5

     * type                                          菜单的响应动作类型,view表示网页类型,click表示点击类型,miniprogram表示小程序类型

     * name                                          菜单标题,不超过16个字节,子菜单不超过60个字节

     * key         click等点击类型必须                  菜单KEY值,用于消息接口推送,不超过128字节

     * url         viewminiprogram类型必须         网页 链接,用户点击菜单可打开链接,不超过1024字节。 typeminiprogram时,不支持小程序的老版本客户端将打开本url

     * media_id     media_id类型和view_limited类型必须 调用新增永久素材接口返回的合法media_id

     * appid     miniprogram类型必须                 小程序的appid(仅认证公众号可配置)

     * pagepath miniprogram类型必须                  小程序的页面路径

     *

     * by Vision

     */

    public static String API_POST_CREATE_MENU = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";

 

    /**

     * 查询菜单

     *http请求方式:GET

     * 字段             必填                             备注

     * access_token     是                          微信开发者授权token

     * by Vision

     */

    public static String API_GET_QUERY_MENU = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN";

 

    /**

     * 删除菜单

     *  字段             必填                             备注

     * access_token     是                          微信开发者授权token

     * by Vision

     */

    public static String API_GET_DELETE_MENU = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN";

//个性化菜单

    /**

     * 预留

     */

 

//IP

    /**

     * 获取微信服务器ip

     *  字段             必填                             备注

     * access_token     是                          微信开发者授权token

     * by Vision

     */

    public static String API_GET_GETCALLBACKIP ="https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=ACCESS_TOKEN";

 

 

//    客服类

    /**

     * 添加客服账号

     *  http请求方式: POST

     *

     *      "kf_account" : "test1@test",

     *      "nickname" : "客服1",

     *      "password" : "pswmd5",

     *

     *  by Vision

     */

    public static String API_POST_ADDKF = "https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN";

 

    /**

     * 修改客服账号

     * http请求方式: POST

     *

     *      "kf_account" : "test1@test",

     *      "nickname" : "客服1",

     *      "password" : "pswmd5",

     *

     * by Vision

     */

    public static String API_POST_UPDATEKF = "https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN";

 

    /**

     * 删除客服账号

     * http请求方式: GET

     *      "kf_account" : "test1@test",

     *      "nickname" : "客服1",

     *      "password" : "pswmd5",

     *

     * by Vision

     */

    public static String API_GET_DELETEKF = "https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN";

 

    /**

     * 上传客服头像

     * http请求方式: POST/FORM

     *

     * 调用示例:使用curl命令,用FORM表单方式上传一个多媒体文件,curl命令的具体用法请自行了解

     *

     * by Vision

     */

    public static String API_POST_KFHEADIMG = "http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT";

 

    /**

     * 客服发送消息

     * http请求方式: POST

     *  不同的消息类型需要提交不同的参数,具体请查阅官方文档

     *

     * by Vision

     */

    public static String API_POST_KFCONTEXT = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN";

 

    /**

     *  http请求方式: POST

     * 开发者可通过调用客服输入状态接口,返回客服当前输入状态给用户。

     * 字段             必填           备注

     * access_token              调用接口凭证

     * touser                  普通用户(openid

     * command                  "Typing":对用户下发正在输入"状态 "CancelTyping":取消对用户的正在输入"状态

     * by Vision

     */

    public static String API_POST_KF_TYPING = "POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN";

 

//     模板消息类

    /**

     * 设置所行业

     * http请求方式: POST

     *

     *  参数         是否必须     说明

     * access_token         接口调用凭证

     * industry_id1              公众号模板消息所属行业编号

     * industry_id2              公众号模板消息所属行业编号

     *

     * 编号消息请查阅官方文档

     * by  Vision

     */

    public static String API_POST_SET_INDUSTRY = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN";

 

    /**

     * 获取设置的行业信息

     * http请求方式:GET

     *

     * 参数             是否必须     说明

     * access_token              接口调用凭证

     *

     * by Vision

     */

    public static String API_GET_INDUSTRY = "https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN";

 

    /**

     * 获得模板ID

     * http请求方式: POST

     *

     * 参数                是否必须         说明

     * access_token                      接口调用凭证

     * template_id_short             模板库中模板的编号,有“TM**”“OPENTMTM**”等形式

     * by Vision

     */

    public static String API_GET_TEMPLATE = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN";

 

    /**

     * 获取模板列表

     * http请求方式:GET

     * https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN

     *

     * 参数             是否必须     说明

     * access_token              接口调用凭证

     */

    public static String API_GET_ALL_PRIVATE_TEMPLATE = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN";

 

    /**

     * 删除模板

     * http请求方式:POST

     * https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token=ACCESS_TOKEN

     *

     * 参数             是否必须     说明

     * access_token                  接口调用凭证

     * template_id                  公众帐号下模板消息ID

     */

    public static String API_POST_DEL_PRIVATE_TEMPLATE = "https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token=ACCESS_TOKEN";

 

    /**

     * 发送模板消息

     * http请求方式: POST

     * https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN

     * 参数             是否必填     说明

     * touser                      接收者openid

     * template_id                  模板ID

     * url                          模板跳转链接

     * miniprogram                  跳小程序所需数据,不需跳小程序可不用传该数据

     * appid                      所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系,暂不支持小游戏)

     * pagepath                      所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar),暂不支持小游戏

     * data                          模板数据

     * color                      模板内容字体颜色,不填默认为黑色

     *

     */

    public static String API_POST_SENDTEMPLATE = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";

 

//    自动回复类

    /**

     * http请求方式: GET(请使用https协议)

     * https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN

     *  具体参数请查阅官方文档

     */

    public static String API_GET_CURRENT_AUTOREPLY_INFO = "https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=ACCESS_TOKEN";

}

   更多关于微信API的信息,也可以咨询99API了解。

 


1

电子邮箱:

service@99api.com

联系电话:

17350028402

微信客服:

电子邮箱:

service@99api.com

联系电话:

17350028402

微信客服: