I have below code to fetch account details from salesforce using REST API. But i am getting bad request status in the response(400). Could you please help me on this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Specialized;
using System.Net;
public class DemoController
{
static void Main(string[] args)
{
try
{
string endPOINTURL = String.Format("https://chaithraservicecloudsso-dev-ed.my.salesforce.com/services/data/v37.0/sObjects/Account");
var httpWebRequest = (HttpWebRequest)WebRequest.Create(endPOINTURL);
httpWebRequest.Method = "GET";
httpWebRequest.Accept = "application/Json";
//httpWebRequest.Headers.Add("Content-Type", "application/json");
httpWebRequest.Headers.Add("Authorization", "Bearer 00D280000017weU!ARgA_DoNotPublishYourFullSessionId__L7CvP7t9DxTn3dF3MBxy");
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Console.WriteLine("Response" + httpResponse);
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
}
}