产品详情
API参数 oilPrice 调用地址: http,https://wanwuoil.api.bdymkt.com/todayOilPrice/ 请求方式: POST 支持格式: application/json;charset=UTF-8 调用工具: 去调试 请求参数(Headers) 请求参数(Query) 请求参数(Body) 请求参数(Path) 请求示例 javapythongocurlphpnodejs 示例代码使用, 需要使用Maven加入依赖
<dependency>
<groupId>com.baidubce</groupId>
<artifactId>api-explorer-sdk</artifactId>
<version>1.0.0</version>
</dependency>
import com.baidubce.http.ApiExplorerClient;
import com.baidubce.http.AppSigner;
import com.baidubce.http.HttpMethodName;
import com.baidubce.model.ApiExplorerRequest;
import com.baidubce.model.ApiExplorerResponse;
// oilPrice Java示例代码
public class RequestDemo {
public static void main(String[] args) {
String path = "http://gwgp-mzxbhwrhr7a.n.bdcloudapi.com/todayOilPrice/";
ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path);
request.setCredentials("您的 access key", "您的 secret key");
request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8");
ApiExplorerClient client = new ApiExplorerClient(new AppSigner());
try {
ApiExplorerResponse response = client.sendRequest(request);
// 返回结果格式为Json字符串
System.out.println(response.getResult());
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击复制代码
正常返回示例 d){"code":0,"msg":"success","time":"2017-10-01 09:56:30","data":{"北京":{"92#":6.45,"95#":6.86,"98#":7.54,"0#":6.08},"上海":{"92#":6.41,"95#":6.82,"98#":7.52,"0#":6.02},"江苏":{"92#":6.43,"95#":6.83,"98#":7.59,"0#":6.01},"天津":{"92#":6.44,"95#":6.8,"98#":7.72,"0#":6.04},"江西":{"92#":6.42,"95#":6.8,"98#":7.89,"0#":6.09},"重庆":{"92#":6.52,"95#":6.89,"98#":7.76,"0#":6.13},"辽宁":{"92#":6.44,"95#":6.88,"98#":7.46,"0#":6},"安徽":{"92#":6.42,"95#":6.89,"98#":7.7,"0#":6.08},"内蒙古":{"92#":6.33,"95#":6.8,"98#":7.5,"0#":5.87},"福建":{"92#":6.42,"95#":6.86,"98#":7.51,"0#":6.04},"宁夏":{"92#":6.36,"95#":6.72,"98#":7.7,"0#":5.95},"甘肃":{"92#":6.35,"95#":6.78,"98#":7.21,"0#":5.96},"青海":{"92#":6.4,"95#":6.86,"98#":0,"0#":5.98},"广东":{"92#":6.47,"95#":7.01,"98#":7.51,"0#":6.06},"山东":{"92#":6.43,"95#":6.9,"98#":7.4,"0#":6.04},"广西":{"92#":6.51,"95#":7.04,"98#":7.8,"0#":6.11},"山西":{"92#":6.41,"95#":6.92,"98#":7.62,"0#":6.1},"贵州":{"92#":6.57,"95#":6.95,"98#":7.85,"0#":6.16},"陕西":{"92#":6.34,"95#":6.7,"98#":7.48,"0#":5.95},"海南":{"92#":7.56,"95#":8.02,"98#":9.06,"0#":6.13},"四川":{"92#":6.49,"95#":6.99,"98#":7.61,"0#":6.15},"河北":{"92#":6.44,"95#":6.8,"98#":7.62,"0#":6.04},"西藏":{"92#":7.28,"95#":7.69,"98#":0,"0#":6.55},"河南":{"92#":6.45,"95#":6.89,"98#":7.54,"0#":6.03},"新疆":{"92#":6.22,"95#":6.68,"98#":7.52,"0#":5.83},"黑龙江":{"92#":6.35,"95#":6.73,"98#":7.77,"0#":5.68},"吉林":{"92#":6.41,"95#":6.92,"98#":7.54,"0#":5.97},"云南":{"92#":6.42,"95#":6.89,"98#":7.57,"0#":5.96},"湖北":{"92#":6.45,"95#":6.91,"98#":7.46,"0#":6.04},"浙江":{"92#":6.43,"95#":6.83,"98#":7.49,"0#":6.03},"湖南":{"92#":6.41,"95#":6.81,"98#":7.61,"0#":6.11}}}
失败返回示例 错误码定义
