我需要通过 jersey 客户端为 REST 调用设置这些标头。clickatell 消息 发送 休息 电话
curl -i \
-X POST \
-H "X-Version: 1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Your Authorization Token" \
-H "Accept: application/json" \
我的代码是:
Client client = Client.create();
WebResource webResource = client.resource("https://api.clickatell.com/rest/message");
ClientResponse response = webResource
.header("Authorization", "Bearer clickATellAuthKey")
.header("X-Version", "1")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.post(ClientResponse.class, input);
我收到此错误:
{“错误”:{“代码”:“001”,“描述”:“身份验证失败”,“文档”:“ http://www.clickatell.com/help/apidocs/error/001.htm ”}}
该文件说未指定身份验证标头。该请求在具有相同标头的 Postman(chrome restful 客户端扩展)中运行良好
需要帮忙。