Skip to content

Instantly share code, notes, and snippets.

@mkorman
Created May 16, 2016 13:15
Show Gist options
  • Save mkorman/9b8d0ae408d04fa8433567d9c42d1ad6 to your computer and use it in GitHub Desktop.
Save mkorman/9b8d0ae408d04fa8433567d9c42d1ad6 to your computer and use it in GitHub Desktop.
public string Query (string soqlQuery)
{
using (var client = new HttpClient())
{
string restRequest = InstanceUrl + API_ENDPOINT + "query/?q=" + soqlQuery;
var request = new HttpRequestMessage(HttpMethod.Get, restRequest);
request.Headers.Add("Authorization", "Bearer " + AuthToken);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-PrettyPrint", "1");
var response = client.SendAsync(request).Result;
return response.Content.ReadAsStringAsync().Result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment