For Developers

Rostering Basics

Using Edlink's Graph API, you can extract mass amounts of provider data at a time, and use it to populate your own database. We typically call the procedure of retrieving all of the data for an integration a "full sync."

You'll want to make sure you've read the "Graph API Authorization" section of the authorization guide to prepare to fetch data from Edlink.

You may also want to reference our paginated requests guide to understand some of the URL parameters that you'll see me use in this guide.

Extracting Data

In order to extract data, we'll paginate through various endpoints in the Graph API that correspond to each of our primary school data models.

// Create an axios request config with our token
// (Remember, it should never actually be hard-coded like this)
const config = {
    headers: {
        Authorization: 'Bearer XxYUqqrxHBo6yWBqcry8b73GhibnrQyq'
    }
};

// Create an array to hold all of our schools
const schools = [];

// This field will hold the url for our next request
// We'll get 10000 items at a time for maximum efficiency
let url = 'https://ed.link/api/v2/graph/schools?$first=10000';

// While our url is not undefined or empty
while (url) {
    // Wait for the result of the api call to Edlink
    const result = await axios.get(url, config).then((res) => res.data);

    // Push all of the resulting data to our schools array
    schools.push(...result.$data);

    // Set the url variable so we get the next page on the next loop
    // (If $next is undefined, our pagination is over & the loop will end)
    url = result.$next;
}

// At this point, you'll have all of your integration's schools
// stored in the schools array. Rinse and repeat for all of the
// other data model types.

If you're performing a full sync, it's recommended to access the school data models in the following order:

  1. District https://ed.link/api/v2/graph/districts
  2. School https://ed.link/api/v2/graph/schools
  3. Session https://ed.link/api/v2/graph/sessions
  4. Course https://ed.link/api/v2/graph/courses
  5. Person https://ed.link/api/v2/graph/people
  6. Class https://ed.link/api/v2/graph/classes
  7. Enrollment https://ed.link/api/v2/graph/enrollments
  8. Agent https://ed.link/api/v2/graph/agents

We recommend this order because it ensures that, for example, a class will be loaded before an enrollment ever depends on it.

A more complete sample code file for performing a full sync can be found here.