This article includes the following topics:

OAuth 2 Authorization

Request:

The request for client credentials must contain WWW BASIC authorization with both the client_id and client secret key in the request header, such as: ‘Authorization’: ‘Basic {data}’, where data = Base64.encode(‘{client_id}:{client secret}’).


POST datahub/oauth/token Endpoint for authenticating a client.

 

PARAMETER MODE TYPE DESCRIPTION
grant_type required String The type of the response (should be: ‘client_credentials’)

Example:

METHOD POST
URL https://{hostname}/datahub/oauth/auth
BODY grant_type=client_credentials
HEADERS Authorization: Basic Y2xpZW50aWQ6Y2xpZW50c2VjcmV0


Response:

The API returns the following response on successful authentication:

{
  "access_token": "zyx",
  "token_type": "bearer",
  "expires_in": 7199
}

FIELD TYPE DESCRIPTION
access_token String OAuth 2.0 Access Token
token_type String Token type, which is always 'bearer.’
expires_in Integer Expiration time in seconds
scope String List of scopes that define the data access level.


back to top

API Overview

Districts

GET datahub/services/v1/districts Retrieves a list of districts you have access to.
GET datahub/services/v1/districts/{id} Retrieves information of a specific district.
GET datahub/services/v1/districts/{id}/schools Retrieves a list of schools you have access to for a specific district.
GET datahub/services/v1/districts/{id}/teachers Retrieves a list of teachers you have access to for a specific district.
GET datahub/services/v1/districts/{id}/students Retrieves a list of students you have access to for a specific district.
GET datahub/services/v1/districts/{id}/sections Retrieves a list of sections you have access to for a specific district.
GET datahub/services/v1/districts/{id}/admins Retrieves all the users with admin access to a district.
GET datahub/services/v1/districts/{id}/status Retrieves the status of a district .
GET datahub/services/v1/districts/{id}/events Retrieves all events for all resources belonging to this district.


back to top

Teachers

GET datahub/services/v1/teachers Gets a list of teachers you have access to.
GET datahub/services/v1/teachers/{id} Get only a specific teacher's information.
GET datahub/services/v1/teachers/{id}/events Retrieves events for teachers.
GET datahub/services/v1/teachers/{id}/sections Retrieves a list of all sections for a teacher.
GET datahub/services/v1/teachers/{id}/school Retrieves information about the school for a teacher.
GET datahub/services/v1/teachers/{id}/district Retrieves district information for a teacher.
GET datahub/services/v1/teachers/{id}/students Retrieves all students that a teacher has in their sections.
GET datahub/services/v1/teachers/{id}/grade_levels Retrieves a list of all grade levels taught by a specific teacher.


back to top

Students

GET datahub/services/v1/students Gets a list of students you have access to.
GET datahub/services/v1/students/{id} Get only a specific student's information.
GET datahub/services/v1/students/{id}/events Retrieves events for students.
GET datahub/services/v1/students/{id}/sections Retrieves a list of all sections for a student.
GET datahub/services/v1/students/{id}/school Retrieves information about the school for a student.
GET datahub/services/v1/students/{id}/district Retrieves district information for a student.
GET datahub/services/v1/students/{id}/teachers Retrieves all teachers for a student.
GET datahub/services/v1/students/{id}/contacts Retrieves all contacts for a student.


back to top

Sections

GET datahub/services/v1/sections Gets a list of sections you have access to.
GET datahub/services/v1/sections/{id} Get only a specific section's information.
GET datahub/services/v1/sections/{id}/events Retrieves events for sections.
GET datahub/services/v1/sections/{id}/school Retrieves information about the school for a section.
GET datahub/services/v1/sections/{id}/district Retrieves district information for a section.
GET datahub/services/v1/sections/{id}/students Retrieves a list of all the section's students.
GET datahub/services/v1/sections/{id}/teachers Retrieves a list of all the section's teachers.
GET datahub/services/v1/sections/{id}/teacher Retrieves information about the primary teacher of a section.


back to top

Schools

GET datahub/services/v1/schools Gets a list of schools you have access to.
GET datahub/services/v1/schools/{id} Get only a specific school's information.
GET datahub/services/v1/schools/{id}/events Retrieves events for schools.
GET datahub/services/v1/schools/{id}/teachers Retrieves a list of all teachers for a specific school.
GET datahub/services/v1/schools/{id}/students Retrieves a list of all students for a specific school.
GET datahub/services/v1/schools/{id}/sections Retrieves a list of all sections for a specific school.
GET datahub/services/v1/schools/{id}/district Retrieves district information for a school.


back to top

District Administrators

GET datahub/services/v1/district_admins Retrieves all users with admin access to a district.
GET datahub/services/v1/district_admins/{id} Retrieves a district admin.


back to top

School Administrators

GET datahub/services/v1/school_admins Gets a list of school admins you have access to.
GET datahub/services/v1/school_admins/{id} Get only a specific school admin's information.
GET datahub/services/v1/school_admins/{id}/schools Retrieves all schools for a school admin.


back to top

Events

GET datahub/services/v1/events Gets a list of all events that have occurred within data you have access to see.
GET datahub/services/v1/events/{id} Retrieves specific event information.


back to top

Contacts

GET datahub/services/v1/contacts Gets a list of student contacts you have access to.
GET datahub/services/v1/contacts/{id} Get only a specific student contact's information.
GET datahub/services/v1/contacts/{id}/student Retrieves the student for a contact.
GET datahub/services/v1/contacts/{id}/district Retrieves the district for a contact.


back to top

Common Request Rarameters

PARAMETER MODE TYPE DESCRIPTION
access_token required String Access token obtained during authorization.
id required GUID An ID of a requested entity.
limit Optional Number Max records returned (default 100).
page Optional Number Which page of results to return (default 1).
search_token Optional String URI that allows getting the next page of the paginated response. It is the value of the uri element that follows rel": "NEXT" in the links section of the JSON response (see example in the next section).


back to top

JSON Response Structure

With a single data entity:

{
  "data": {
    "id": "000bc9f5-8496-4b40-92d5-97d74f9b21f8",
    "attribute1": "value of attribute 1",
    "attribute2": "value of attribute 2",
    "attribute3": "value of attribute 3"
  },
  "links": [
    {
      "rel": "self",
      "uri": "/v1/entityname/000bc9f5-8490-4b4c-92d5-97d74f9b21f8"
    },
    {
      "rel": "related-entity1",
      "uri": "/v1/entityname/000bc9f5-8490-4b4c-92d5-97d74f9b21f8/related-entity1"
    },
    {
      "rel": "related-entity2",
      "uri": "/v1/districts/000bc9f5-8496-4b40-92d5-97d74f9b21f8/related-entity2"
    }
  ]
}


With multiple data entities:

{
  "data": [
    {
      "data": {
        "id": "000bc9f5-8496-4b40-92d5-97d74f9b21f8",
        "attribute1": "value of attribute 1",
        "attribute2": "value of attribute 2",
        "attribute3": "value of attribute 3"
      },
      "uri": "/v1/entityname/000bc9f5-8496-4b4c-92d5-97d74f9b21f8"
    },
    {
      "data": {
        "id": "111ac1f5-8496-4b40-92d5-97d74f9b21f9",
        "attribute1": "value of attribute 1",
        "attribute2": "value of attribute 2",
        "attribute3": "value of attribute 3"
      },
      "uri": "/v1/entityname/111ac1f5-8490-4b4c-92d5-97d74f9b21f9"
    },
    ...
  ],
  "paging": {
    "current": 1,
    "total": 2,
    "count": 148
  },
  "links": [
    {
      "rel": "NEXT",
      "uri": /v1/entityname?search_token=2.2.148.FORWARD.111ac1f5-8490-4b4c-92d5-97d74f9b21f9"
    },
    {
      "rel": "SELF",
      "uri": "/v1/entityname"
    }
  ]
}


back to top