Mary,
We are using c# to do api calls, below is part of the code which should point you in the right direction.
public static Course GetCourseByCourseId(int courseId, string canvasApiDomain)
{
string url = "/api/v1/accounts/" + ConfigurationManager.AppSettings["PsuAccount"] + "/courses/" + courseId;
HttpHelper myHelper = new HttpHelper(canvasApiDomain);
Course myCourse = myHelper.GetSingleItem<Course>(url);
return myCourse;
}
public HttpHelper(string baseUrl)
{
_baseUrl = baseUrl;
_jsonSettings = new Newtonsoft.Json.JsonSerializerSettings();
_jsonSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
_jsonSettings.MissingMemberHandling = MissingMemberHandling.Ignore;
}
public T GetSingleItem<T>(string apiUrl)
{
T retval = default(T);
using (HttpClient client = SetupClient())
{
HttpResponseMessage response = client.GetAsync(apiUrl).Result;
if (response.IsSuccessStatusCode)
{
string responseResult = response.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrWhiteSpace(responseResult))
{
retval = JsonConvert.DeserializeObject<T>(responseResult, _jsonSettings);
}
}
}
return retval;
}