Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

Salesforce Bulk Api "Create Job must be a POST request" error

I want to create a query job using Bulk API. I have logged in succesfully in my sandbox using curl. I now have a sessionId and a serverURL returned by Salesforce.

I have an XML that creates a query job:

create-query-job.xml

<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
    <operation>query</operation>
    <object>Account</object>
    <concurrencyMode>Parallel</concurrencyMode>
    <contentType>CSV</contentType>
</jobInfo>

My curl statement is:

curl -H "X-SFDC-Session: 0012010!ASAAA.912AASAVASAAS" -H "Content-Type: application/xml; charset=UTF-8" -D @create-query-job.xml https://instance--Dev.my.salesforce.com/services/async/50.0/job

For security reasons, I have not pasted the real session Id or the instance name, but you get it :) I read in some documentation that on Mac (which I'm using), you need to either escape the exclamation point on the sessionId (tried - same error) or enclose the sessionId in single quotes (tried->Invalid session id error this time).

So trying this, I get the error:

<?xml version="1.0" encoding="UTF-8"?><error
   xmlns="http://www.force.com/2009/06/asyncapi/dataload">
 <exceptionCode>InvalidUrl</exceptionCode>
 <exceptionMessage>Create Job must be a POST request</exceptionMessage>

How can I fix this and create the Job, returning the jobId ? Thank you for your ans


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...