Finding a course by external ID via web service
Clients using the external ID to identify EthosCE courses from a remote system, may need find the internal nid of a course. This may be accomplished via a GET call to the course endpoint. This endpoint does not support creation or update calls, as all information is automatically created when a course node is created or updated.
GET Call
Return all course objects with an External ID of external_1234.
<?php
$curl = curl_init('http://your-domain/course.xml?external_id=external_1234');
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "admin:webservicepw"); //Your credentials goes here
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
// Your session token and content type
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
print curl_exec($curl);
If non-unique external ID values are used, the system may return more than one course object in the list.
Return structure
The return is a collection of course object information, associated to the course node. The course nid is found in the nid object, a reference to the course node. The path is: course → nid → id.
Course (course)
var course =
{
"nid": {
"uri": "http:\/\/your-domain.com\/node\/1",
"id": "1",
"resource": "node",
"uuid": "f37bd30a-25c5-4b51-9f97-1243d9844b28"
},
// The outline type
"outline": "course",
"credits": null,
"open": "1493411400",
"close": "1514745060",
"duration": "0",
"external_id": "external_1234",
// The enrollment question bundle associated to a course. The default is 'course_enrollment'.
"enrollment_type": "course_enrollment",
// Course Relationship Settings
"relationships": {
"credit_options": "normal",
"enroll_options": "parent",
"auto_enroll": "1"
},
"course_date_open": true,
// Enabled credit on the course
"course_credit_types": [],
// An internal identifier
"feed_nid": null
}