尝试了三种办法(实际是两个解析URL的包和函数),但是最后返回值都是时间格式错误,不晓得问题出在哪里。
接口调用请求说明接口分析数据接口(包括接口列表中的所有接口)需要向相应接口调用地址POST以下示例数据包:
- {
- "begin_date": "2014-12-07",
- "end_date": "2014-12-07"
- }
方法1\2是用的RCurl包的postForm,方法3用的httr包,但最后返回错误值都是61500-时间格式错误。
请问是我的参数设置问题还是其他格式问题?在线等呀,谢谢~
附上Rgui图
- > #方法1
- > postForm(URL, begin_date=2016-04-07, end_date=2016-04-10)
- [1] "{\"errcode\":61500,\"errmsg\":\"date format error hint: [zD9Jqa0754re46]\"}"
- attr(,"Content-Type")
- encoding
- "application/json" "utf-8"
- >
- > #方法2
- > list2 <- list(begin_date="2016-04-07", end_date="2016-04-10")
- > postForm(URL, .params = list2)
- [1] "{\"errcode\":61500,\"errmsg\":\"date format error hint: [1NSMkA0755ube1]\"}"
- attr(,"Content-Type")
- encoding
- "application/json" "utf-8"
- >
- > #方法3 httr包解析
- > library(httr)
- > resp <- POST(URL, body=list2, encode="form")
- > content(resp)
- $errcode
- [1] 61500
- $errmsg
- [1] "date format error hint: [t.Vg70756ube3]"