Request & Response Format

Request Format

The Edunation API is a JSON API. You must supply a Content-Type: application/json header in PUT, POST, and DELETE requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix. In addition, all JSON properties are case sensitive.

curl --request POST \
     --url https://example.com/gradebooks \
     --header 'Accept: application/json' \
     --header 'client_secret: {client_secret}' \
     --header 'Authorization: Bearer {access_token}' \
     --header 'Content-Type: application/json' \
     --data '
{
     "year_id": "6"     
}

Include Additional Fields

In certain services, you can specify additional fields to be included in the JSON results. You will find a parameter called "additional_fields" set in the API reference for such services. This parameter's type is a string that accepts comma-separated field names.
When applicable, you can add user custom fields to be included in the JSON results. To include a custom field, use the following syntax:

customField_{CustomFieldId}

For example, to include the custom fields with ID=25 & ID=30 in your results, you need to set the additional_fields to the following:

{
"additional_fields":"customField_25,customField_30"
}

Here is a sample for complete request to include country name & custom field with ID=12 in the student_roster service:

curl --request POST \
     --url https://gw.edu-nation.net/api/student_roster \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
     --header 'Content-Type: application/json' \
     --header 'client_secret: YOUR_CLIENT_SECRET' \
     --data '
{
     "year_id": 6,
     "additional_fields": "customField_12,countryName"
}
'

Response Format

The Edunation API responds to successful requests with HTTP status codes in the 200 range.

{
    "Result": [
        {
            "userId": 123456,
            "groupName": "Grade 10 A",
            "idnumber": "79546331544",
            "studentName": "Demo  Student",
            "lastName": "Student",
            "gender": "Male",
            "dob": "2002-01-30 00:00:00",       
            "userStatus": "Active",
            "customField15": "custom field value",
            "customField24": "custom field value",
			"data":[
			{
				"parameterName":"custom field title",
				"parameterCategory":"custom field section",
				"parameterValue":"custom field value"
			}
			]
        },
        {
            "userId": 1244567,
            "groupName": "Grade 10 A",
            "idnumber": "795466551544",
            "studentName": "Demo  Teacher",
            "lastName": "Teacher",
            "gender": "Female",
            "dob": "2002-01-30 00:00:00",       
            "userStatus": "Active",
            "customField15": "custom field value",
            "customField24": "custom field value",
			"data":[
			{
				"parameterName":"custom field title",
				"parameterCategory":"custom field section",
				"parameterValue":"custom field value"
			}
			]
        }
   ],
    "Message": "Success",
    "Success": true,
    "StatusCode": 200
}

Error Response

In addition to the HTTP status code, most errors will also return a response body that contains more information to help you debug the error. A sample error response is shown below. The format of the error response body is explained after the example.

{    
    "Message": "You are not authorized to perform this action",
    "ErrorCode": "not_authorized",
    "Success": false,
    "StatusCode": 401
}

Schema

Blank Fields:
Blank fields are included as null instead of being omitted.

Timestamps:
All timestamps are returned in the following format, YYYY-MM-DDTHH:MM:SS. ( Example : 2016-02-13T23:27:49 )

Date Fields:
Input for date fields is expected to be in one of the following formats:
YYYY-MM-DD
YYYY-MM-DDTHH:MM:SS