Preliminary API Documentation

This documentation is preliminary and was written for a very specific audience. Our full API documentation is currently being prepared and will be provided as soon as possible.



Conventions

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

You may obtain a copy of RFC 2119 here: http://tools.ietf.org/html/rfc2119



Terms and Terminology

  • API Key - Needed for API access. All API requests MUST include a valid API key.
  • Authentication Info - Used to establish an API client's permissions within the C2C system.
  • Session Token - Session tokens provide "proof of authentication" for a fixed period of time (TTL; time-to-live). API clients must create a session token before they can use any API endpoints (excluding the /Sessions endpoint, which creates session tokens)


First Steps

Request Access

Before you can begin using the C2C API, you must request access from C2C.

Once access has been granted you will be provided with a username, password, and api key.


Create a Session

Before you can use any significant endpoint, you must request a "session token" from the /Sessions endpoint.

curl -X POST -H "x-api-key: <API_KEY>" -H "Content-Type: application/vnd.api+json" -H "Cache-Control: no-cache" -d '{"data":{"username":"<USERNAME>","password":"<PASSWORD>,"ttl":3600}}' "https://api.c2cs.io/v3/Sessions"

You should receive a JSON document that looks similar to the following:

{  
"meta": { "requestId": "4225fbb3-0ee3-11e7-9054-51817d5fb12d", "seriesId": "4225fbb3-0ee3-11e7-9054-51817d5fb12d" }, "data": { "type": "Session", "id": "dc97707f-71d9-475c-a378-c8054eb3f7a1", "attributes": { "token": "eyJhbGci..truncated..OiJIUzI1pqblU" } }, "jsonapi": { "version": "1.0" } }

The important part of that document is the data.attributes.token property, which you'll need to capture, store, and send with each subsequent request.



Available Endpoints

GET /SchoolDistricts/:schoolDistrictId/Schools


Example Request

curl -X GET -H "x-api-key: <API_KEY>" -H "Content-Type: application/vnd.api+json" -H "X-Session-Token: <SESSION_TOKEN>" -H "Cache-Control: no-cache" "https://api.c2cs.io/v3/SchoolDistricts/43dbd4fa-0ad9-11e7-8ff5-0e8c1e1ec0af/Schools"


Example Response

{
  "meta": {
    "requestId": "462615b9-0ee5-11e7-aea1-41827d13a486",
    "seriesId": "462615b9-0ee5-11e7-aea1-41827d13a486"
  },
  "data": [
    {
      "type": "School",
      "id": "0328d5bf-b1df-4fad-b696-b696-b514771cc9c6",
      "attributes": {
        "name": "WILKINSON COUNTY HIGH SCHOOL",
        "nameNormalized": "wilkinson county high school",
        "commonName": "Wildcats",
        "commonNameNormalized": "wildcats",
        "abbreviation": "WCHS",
        "url": "",
        "memberGender": "any",
        "createdDateTime": "2013-12-23T09:43:23.000Z",
        "updatedDateTime": "2014-07-08T15:18:03.000Z"
      }
    },
    {
      "type": "School",
      "id": "8e9f268b-94d2-4f0f-b7bb-b7bb-fdf581db7dfd",
      "attributes": {
        "name": "WILLIAM WINANS MIDDLE SCHOOL",
        "nameNormalized": "william winans middle school",
        "commonName": "William Winans Middle",
        "commonNameNormalized": "william winans middle",
        "abbreviation": "WWMS",
        "url": "wilkinson.k12.ms.us",
        "memberGender": "any",
        "createdDateTime": "2013-12-23T09:55:58.000Z",
        "updatedDateTime": "2016-07-12T16:42:33.000Z"
      }
    }
  ],
  "jsonapi": {
    "version": "1.0"
  }
}



POST /Students/validate


Example Request

curl -X POST -H "x-api-key: <API_KEY>" -H "Content-Type: application/vnd.api+json" -H "X-Session-Token: <SESSION_TOKEN>" -H "Cache-Control: no-cache" -d '{"data":{"schoolId":"<SCHOOL_ID>","firstName":"<FIRST_NAME>","lastName":"<LAST_NAME>","birthDate": "<BIRTHDATE>"}}' "https://api.c2cs.io/v3/Students/validate"


Example Response (Successful Validation)

{
  "meta": {
    "requestId": "2d812812-0ee8-11e7-9e7a-375a053936d1",
    "seriesId": "2d812812-0ee8-11e7-9e7a-375a053936d1"
  },
  "data": {
    "type": "ValidationResult",
    "id": "2d812812-0ee8-11e7-9e7a-375a053936d1",
    "attributes": {
      "valid": true
    },
    "relationships": {
      "student": {
        "data": {
          "type": "Student",
          "id": "042f54d3-1ba6-4114-8327-8329-c4de6baa8102"
        }
      }
    }
  },
  "jsonapi": {
    "version": "1.0"
  }
}


Example Response (Unsuccessful Validation)

{
  "meta": {
    "requestId": "25a3f45e-0ee9-11e7-a5e1-9ba99bcd1e59",
    "seriesId": "25a3f45e-0ee9-11e7-a5e1-9ba99bcd1e59"
  },
  "data": {
    "type": "ValidationResult",
    "id": "25a3f45e-0ee9-11e7-a5e1-9ba99bcd1e59",
    "attributes": {
      "valid": false
    }
  },
  "jsonapi": {
    "version": "1.0"
  }
}




Is this article helpful for you?