直接用方法
public static void main(String[] args) {
String url = "http://www.mysada.com/ar_AE/api/article_categories";
Map<String,Object> params = new HashMap<>();
Request req = Request.create(url, METHOD.POST, params, null);
req.getHeader().set("Access-Token", "ABXDEF-GHIJK-LMNOP-QRSTUVW-XYZ");
try {
Response resp = Sender.create(req).send();
if (resp.isOK()) {
String res = resp.getContent();
System.out.println(res);
} else {
log.errorf("status %s ", resp.getStatus());
}
} catch (Exception e) {
log.error(e);
}
}
返回的结果是
{
"code": 1,
"message": "Request successfully",
"content": [
{
"id": "1",
"title": "\u0639\u0631\u0628\u064a",
"display_order": "0"
},
{
"id": "2",
"title": "\u062f\u0648\u0644\u064a",
"display_order": "1"
},
{
"id": "3",
"title": "\u0625\u0642\u062a\u0635\u0627\u062f",
"display_order": "2"
},
{
"id": "4",
"title": "\u0643\u0631\u0629 \u0642\u062f\u0645",
"display_order": "3"
},
{
"id": "6",
"title": "\u062a\u0643\u0646\u0648\u0644\u0648\u062c\u064a\u0627",
"display_order": "5"
},
{
"id": "7",
"title": "\u062a\u0631\u0641\u064a\u0647",
"display_order": "6"
},
{
"id": "8",
"title": "\u0645\u0634\u0627\u0647\u064a\u0631",
"display_order": "7"
},
{
"id": "9",
"title": "\u062d\u0648\u0627\u0621",
"display_order": "8"
},
{
"id": "5",
"title": "\u0645\u0635\u0631",
"display_order": "9"
},
{
"id": "17",
"title": "\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629",
"display_order": "10"
},
{
"id": "10",
"title": "\u0633\u064a\u0627\u0631\u0627\u062a",
"display_order": "11"
},
{
"id": "11",
"title": "\u0639\u0644\u0648\u0645",
"display_order": "12"
},
{
"id": "12",
"title": "\u0623\u0644\u0639\u0627\u0628",
"display_order": "13"
},
{
"id": "14",
"title": "\u0633\u064a\u0627\u062d\u0629",
"display_order": "14"
},
{
"id": "15",
"title": "\u0637\u0628\u062e",
"display_order": "15"
},
{
"id": "16",
"title": "\u0635\u062d\u0629",
"display_order": "16"
},
{
"id": "13",
"title": "\u0627\u0644\u0625\u0645\u0627\u0631\u0627\u062a",
"display_order": "17"
}
]
}
而用在线工具
http://www.atool.org/httptest.php
测试返回的数据则是
{
"code": 1,
"message": "Request successfully",
"content": [
{
"id": "1",
"title": "\u0639\u0631\u0628\u064a",
"display_order": "0"
}
]
}
这会是哪个地方的问题?