weixin4j-qy-api

微信企业号开发工具包

功能列表

  • DepartApi 部门管理API

  • UserApi 成员管理API

  • TagApi 标签管理API

如何使用

1.API工程可以单独打包到其他项目中使用,需新增或拷贝weixin.properties文件到项目的classpath

weixin.properties说明

属性名 说明
account 微信企业号信息 json格式
token_path 使用FileTokenHolder时token保存的物理路径
media_path 调用媒体接口时保存媒体文件的物理路径

示例(properties中换行用右斜杆\)

account={"id":"corpid","secret":"corpsecret",\
	"token":"企业号中应用在回调模式下的token",\
	"encodingAesKey":"企业号中应用在回调模式下AES加密密钥"}

token_path=/tmp/weixin/token
media_path=/tmp/weixin/media

2.实例化一个WeixinProxy对象,调用API

WeixinProxy weixinProxy = new WeixinProxy();
// weixinProxy = new WeixinProxy(corpid,corpsecret);
// weixinProxy = new WeixinProxy(weixinAccount);
weixinProxy.getUser(userid);

3.针对token存储有两种方案,File存储/Redis存储,当然也可自己实现TokenHolder(继承AbstractTokenHolder并重写getToken方法),默认使用文件(xml)的方式保存token,如果环境中支持redis,建议使用RedisTokenHolder.

WeixinProxy weixinProxy = new WeixinProxy(new RedisTokenHolder());
// weixinProxy = new WeixinProxy(new RedisTokenHolder(weixinAccount));

4.mvn package.

更新LOG

  • 2014-11-19

    • 新增部门管理接口

    • 新增用户管理接口

    • 新增标签管理接口