码迷,mamicode.com
首页 > 其他好文 > 详细

11111

时间:2020-04-14 17:16:54      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:tpc   service   api   cells   error   pad   arp   list   std   

4.1.1 获取Ticket

1
2
3
4
5
String url = "***";
 
String postString = "{ \"appKey\": \"***\", \"appSecurity\": \"***\", \"accessType\": \"2\"}";
 
String result = PostData (url, postString);

 

POST JSON示例:

1
{"appKey": "***","appSecurity": "***","accessType": "2"}

 

返回JSON示例:

1
2
3
4
5
6
7
8
9
10
11
{
    "status": {
        "success"true,
        "errorCode"null,
        "message"null
    },
    "data": {
        "expireTime": 7200,
        "accessToken""6b30a440a9c426e27de13f63f4170fc0"
    }
}

 

4.1.2 查询子账户信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
        String url = "***";  // 请求链接
        String sign = "9488373060c8483a3ef6333353fdc7fe"// sign
        OkHttpClient okHttpClient = new OkHttpClient(); // OkHttpClient对象
        JSONObject jsonObject = new JSONObject();
        JSONObject jsObject = new JSONObject();
        jsObject.put("appKey""******");
        jsObject.put("accessToken""*****"); // token
        jsonObject.put("authInfo", jsObject);
        jsonObject.put("apiName""QuerySubAccountStructService");   
        JSONObject contentJson = new JSONObject();
        contentJson.put("accountID", 1234);
        contentJson.put("pageIndex", 1);
        contentJson.put("pageSize", 50);
        jsonObject.put("requestContent", contentJson);
        RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8")
                , jsonObject.toJSONString());
        Request request = new Request.Builder().url(url).addHeader("sign", sign).post(requestBody).build(); // 请求
        okHttpClient.newCall(request).enqueue(new Callback() {// 回调
            public void onResponse(Call call, Response response) throws IOException {
                System.out.println(response.body().string());//成功后的回调
            }
            public void onFailure(Call call, IOException e) {
                System.out.println(e.getMessage());//失败后的回调
            }
        });
 
 

POST JSON示例:

1
2
3
4
5
6
7
8
{
    "authInfo":{
        "appKey":"****",
        "accessToken":"5d4cca4b07195715b8003113"
    },
    "requestContent":"{"accountID":1234,pageSize":50,"pageIndex":1}",
    "apiName":"QuerySubAccountStructService"
}
 

 返回JSON示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
    "data": {
        "totalCount": 2,
        "subAccountList": [
            {
                "subAccountID": 4161,
                "subAccountName""subdebtcorp",
                "status""A",
                "userCount": 2
            },
            {
                "subAccountID": 6528,
                "subAccountName""test",
                "status""A",
                "userCount": 893
            }
        ]
    },
    "status": {
        "errorCode": 0,
        "message""返回成功",
        "success"true
    }
}

11111

标签:tpc   service   api   cells   error   pad   arp   list   std   

原文地址:https://www.cnblogs.com/omar/p/12697484.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!