function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
latticelattice 

How to make HttpWebRequest instance for inserting data? What headers should I add to it?

Hi all,

I'm new here.

I'm coding a C# project to update data in Salesforce. When making a request of type HttpWebRequest, I get a sample to set session ID with code  "request.Headers.Add("X-SFDC-Session", sessionID);"

I've no idea why it is "X-SFDC-Session" or where can I find the mapping of header names and key words.

Now I want to set AllOrNoneHeader to be "true". Which key word should I use in HttpWebRequest instance?

 

Any suggestions?

Thank you very much!

s0mbras0mbra

Hi, I'm using the following code to post datas:

 

HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
request.Method = WebRequestMethods.Http.Post;

var token = "yourAccessToken"

request.Headers.Add("Authorization: OAuth " + token);

  webRequest.ContentType = "application/x-www-form-urlencoded";

LELE

Hi,

When trying to get data from Salesforce, I use the header just like yours.

But when inserting data, this header doesn't work. I found an example showing me that request.Headers.Add("X-SFDC-Session", sessionID); would work well.

After test, it does work. But I don't know why it works and whether there is any other header key word like these.

Are they the same? Or what's different between them?

 

Thanks & Regards,

Biao