java实现注册环信账号_java删除环信账号如何操作

在开发实时通信APP时我们经常会使用环信SDK来集成,环信目前来说是比较稳定和高效的即时聊天开发包,开发后台时我们经常需要管理环信的注册用户,删除是我们必须要有的管理手段。

下面的代码是删除环信注册账号的API使用方式:

public static int DeleteCode(String url, List> headerList) {

// TODO Auto-generated method stub

int iPostResultCode = 0;

DeleteMethod deMethod=new DeleteMethod(url);

String strPostResponseBody = "";

for(Mapm:headerList){

deMethod.setRequestHeader(m.get("headerName"), m.get("headerValue"));

}

try {

iPostResultCode = client.executeMethod(deMethod);

strPostResponseBody = deMethod.getResponseBodyAsString();

System.err.println("-->" + iPostResultCode);

System.err.println("===" + strPostResponseBody);

} catch (Exception ex) {

ex.printStackTrace();

} finally {

deMethod.releaseConnection();

}

return iPostResultCode;

}

上面的代码是删除时调的工具方法,只要是执行删除请求的代码,下面我们来调用一下:

4String tokenUrl="http://a1.easemob.com/mdzy/*****/token";

String delUrl="http://a1.easemob.com/*****/*****/users/用户名";

MapparamMap=new HashMap();

paramMap.put("grant_type", "client_credentials");

paramMap.put("client_id", Config.hxclient_id);

paramMap.put("client_secret", Config.hxclient_secret);

MaptokenMap=JsonTools.jsonStrToMap(post(tokenUrl,paramMap));

System.out.println(JsonTools.toJson(tokenMap));

List>headerList=new ArrayList>();

Mapheader=new HashMap();

header.put("headerName", "Authorization");

header.put("headerValue", "Bearer

"+tokenMap.get("access_token").toString());

headerList.add(header);

DeleteCode(delUrl,headerList);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值