Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleWarning!

A web service user account must meet proper naming convention to be valid for authentication. By default, the username must always start with "restws".

Querying EthosCE

Clients may use GET calls, to pull information from the system, including applying advanced filters and sorting.  Reference the Web Service Data Structures page for more information on each content type, their available fields, and accepted values. Most fields, including custom, are available to filter against. Multiple filters may be added to the query string via ampersands. The examples below detail common URL filter configurations.

...

OperatorSyntaxExampleResult
>

[gt]=

user.json?uid[gt]='100'All users with uids greater than (but not equal to) 100
>=[ge]=node.json?created[ge]='1478044800'All nodes created before or equal to 11/02/2016 - 00:00 UTC
<[lt]=user.json?uid[lt]='500'All users with uids less than (but not equal to) 500
<=[le]=user.json?login[le]='1478278815'All users who have logged in before or equal to 11/04/2016 - 17:00 UTC
<>[ne]=credit_awarded.json?type[ne]='attendance'All awarded credit that is not Attendance
=

[eq]=
OR =

credit_awarded.json?type[eq]='ama'
credit_awarded.json?type='ama'
All awarded AMA credit
Contains[ct]=user.json?mail[ct]='ethosce.com'All users with an e-mail address which contains 'ethosce.com'
Starts with[sw]=user.json?name[sw]='jsmith'All users who have a username that starts with 'jsmith'

Query Examples

Code Block
languagephp
titleReturn all credit awarded to user 2, sorted by awarded date
<?php
$curl = curl_init('http://your-domain/course_credit_awarded.xml?uid=2&sort=date&direction=DESC');
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "restws_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);

...

  • 404: Not Found
    • The resource was not found
  • 403: Forbidden
    • The web service user does not have permission to use the resource. 
    • If this error is seen often, verify the session authentication step have been completed.
  • 406: Not Acceptable
    • The data sent to the web service is not in an acceptable format or is missing required fields. Check the documentation for the correct fields and format.
  • 200: OK
    • The web service call is successful. Data may or may not be returned depending on the operation.
  • 201: Created
    • The web service call created data

Example Scenarios

The following examples of standard calls to EthosCE are written in PHP, in JSON, using the Curl library.

Child pages (Children Display)
alltrue
pageWeb Service Examples

Child pages (Children Display)
pageWeb Services