我通过批量apu通过Restforce gem发送一批联系人
response = connection.post("/services/async/#{connection.options[:api_version]}/job/#{job_id}/batch") do |req|
req.headers['Content-Type'] = 'text/csv; charset=UTF-8'
req.headers['X-SFDC-Session'] = connection.options[:oauth_token]
req.headers['Content-Length'] = payload.length.to_s
req.body = Restforce::UploadIO.new(StringIO.new(payload), 'text/csv; charset=UTF-8')
end
有效负载是:
" ACCOUNTID,名字,姓氏,说明,电话,电子邮件\ n0011510001DXiOVAA1,马特,卡利,尼斯 伙计,+ 14150000000,matt @ example.com \ n0011501001DXiOWAA1,Michael,Michael,非常好的人,+ 14150000001,michael @ example.com \ n"
我收到错误:" InvalidBatch:未处理的记录" 我得到的唯一回应。
如何查看我的批次出现了什么问题? 以前它曾经工作过,而且在某些时候它停止了工作。我确保在我创建的试用帐户中添加了所有权限。
请求/响应数据:
struct Faraday :: Env method =:post,body =#Restforce :: Mash batchInfo =#Restforce :: Mash apexProcessingTime =" 0" apiActiveProcessingTime =" 0" createdDate =" 2015-12-06T23:06:28.000Z" ID =" SOME_ID " =的jobId" SOME_ID " numberRecordsFailed =" 0" numberRecordsProcessed =" 0"状态="排队" systemModstamp =" 2015-12-06T23:06:28.000Z" totalProcessingTime =" 0">>中 URL =#HTTPS://na22.salesforce.com/services/async/33.0/job/*SOME_ID*/batch> ;, request =#,request_headers = {" User-Agent" =>"法拉第 v0.9.2"," Content-Type" =>" text / csv;字符集= UTF-8&#34 ;, " X-SFDC-Session" =>" SOME_SESSION_ID "," Content-Length" =>" 233& #34 ;, "授权" =>" SOME_AUTH_ID "},ssl =#,parallel_manager = nil,params = nil, 响应=#> @ URL =#URI :: HTTPS https://na22.salesforce.com/services/async/33.0/job/ SOME_ID /批> @ request = #Faraday :: RequestOptions timeout = 600秒, open_timeout = 600秒> @request_headers = {"用户代理" = GT;"法拉第 v0.9.2"," Content-Type" =>" text / csv;字符集= UTF-8&#34 ;, " X-SFDC-Session" =>" SOME_ID "," Content-Length" =>" 233& #34 ;, "授权" =>" SOME_ID "} @ ssl = #Faraday :: SSLOptions verify = true> @ response = #Faraday :: Response:0x007f22b44a78 ...> @response_headers = {" date" =>" Sun,06 Dec 2015 23:06:28 GMT", "的Set-Cookie" = GT;" * SOME_DATA>&#34 ;, "位置" = GT;" /services/async/33.0/job/ SOME_ID /批次/ SOME_ID &#34 ;, "内容类型" =>" application / xml"," transfer-encoding" =>" chunked", "连接" =>"关闭"} @ status = 201>>,response_headers = {"日期" =>" Sun, 06 Dec 2015 23:06:28 GMT"," set-cookie" =>" SOME_ID ", "到期" = GT;" SOME_ID &#34 ;, "位置" = GT;" /services/async/33.0/job/ SOME_ID /批次/ SOME_ID &#34 ;, "内容类型" =>" application / xml"," transfer-encoding" =>" chunked", "连接" =>"关闭"},状态= 201>
答案 0 :(得分:1)