【问题标题】:Using Zuora Rest API with R将 Zuora Rest API 与 R 一起使用
【发布时间】:2017-04-17 15:57:53
【问题描述】:

我正在尝试从 Zuora 中提取一些数据,但 rjson 抛出错误。

library(httr) 
library(rjson)

query <- "https://api.zuora.com/rest/v1"
getdata <- GET(url=query, add_headers(apiAccessKeyId="Username", apiSecretAccessKey = "Password", Content-Type = "application/json"))
q <- fromJSON(content(getdata,type="text"))

错误:

No encoding supplied: defaulting to UTF-8.
Error in fromJSON(content(getdata, type = "text")) : 
  unexpected character '<'

非常感谢任何帮助。

【问题讨论】:

    标签: r api httr rjson zuora


    【解决方案1】:
    auth <- add_headers(apiAccessKeyId = "username", apiSecretAccessKey = "password")
    body = paste('{
      "Format": "csv",
                 "Name": "test",
                 "Query": "select * from invoice",
                 "Status": "Processing",
                 "Zip": false
                 }')
    
    getdata <- POST("https://rest.zuora.com/v1/object/export", auth, body = body)
    r <- fromJSON(content(getdata, type = "text"))
    

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      • 2014-03-15
      • 1970-01-01
      • 2017-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多