Skip to main content
This guide reads every allocation of your organization from Read Allocations Feed and stores them in a local SQLite database. When the copy has every allocation, it waits and then reads the new ones.
This is a simplified implementation. It shows how to read from the API. How you store the records, handle errors and run the loop in your own system is up to you.
You need an API key (see Authentication) and Python with httpx installed.

How the script reads the feed

  1. It reads a page. after is the feed_sequence of the last record in the copy, or 0 when the copy is empty.
  2. It reads the response line by line and stores each line in the same transaction. The response is JSON Lines: each line is one allocation record.
  3. When a response is empty, the copy has every record that Engrate stored. The script waits and reads again.

The script

copy_allocations.py
Run it with your API key:

Next steps