Skip to content

openreferral/mock-hsds-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HSDS Mock API

This is a very basic Mock API for testing tooling related to the HSDS Specification.

How it works

You provide HSDS data as JSON files inside the data/ directory, divided up by different schema type. You just need to provide files containing individual services, organizations, taxonomies etc. where the file name is the UUID of that object, and the script will handle the rest.

Example: the service object with UUID ac148810-d857-441c-9679-408f346de14b should be stored as the file data/services/ac148810-d857-441c-9679-408f346de14b.json

The Mock API will handle retrieving lists of objects for you and build the Page schema required by the HSDS API Specification, so all you need to do is provide the JSON files representing your objects to mock an API setup.

The Mock API will run on port 5000, so to get a list of all services you'll need to visit http://localhost:5000/services. Some users report not being able to access localhost:5000, so depending on the configuration of your system you might need to use http://127.0.0.1:5000/services instead.

Running the application

  1. Set up the Python virtual environment:
python3 -m venv .ve
source .ve/bin/activate
  1. Install the dependencies into the environment
pip install -r requirements.txt
  1. Run the application ./app.py

  2. Start querying the API: http://localhost:5000 or http://127.0.0.1:5000

Limitations

No support for parameters

There is currently no support for parameters in the Mock API on any endpoint

Large datasets may cause you to run out of memory

This tool is designed to mock up a basic API with some data for you to test HSDS tools against an API. It doesn't attempt to paginate or stream any data, and naïvely puts responses in a single Page object. This means if you dump 4000 services into the data/services/ directory, the mock API will respond to GET /services by giving you a single page of 4000 services!

About

A barebones Python Flask program that mimics an Open Referral API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages