HATS School API Specification
Notes
The field libraryStatus
is represented by an enum that can have the following values:
- "UNKNOWN"
- "EXISTS"
- "DOES_NOT_EXIST"
The field country
is represented by an enum that can have the following values:
- "UNITED_STATES"
- "ANTIGUA_AND_BARBUDA"
- "DOMINICA"
- "GRENADA"
- "ST_KITTS_AND_NEVIS"
- "ST_LUCIA"
- "ST_VINCENT_AND_THE_GRENADINES"
Protected Routes
All of these routes must be called by a user that is already authenticated.
Get All Schools
Used to return a list of all schools.
GET
request to /api/v1/protected/schools
Responses:
200 OK
: returns a list of schools and the count of schools returned:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
401 Unauthorized
: the user is not authenticated
Get One School
Used to return information about a single school.
GET
request to /api/v1/protected/schools/:school_id
Responses:
200 OK
: returns information about the requested school:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Create One School
Used to create a single school record. Before creating the school, we check if a school with this name, address, and country already exists. If yes, and the school was previously deleted or hidden, we un-delete the and update the hidden field to the given value.
POST
request to /api/v1/protected/schools
with body:
1 2 3 4 5 6 7 8 9 10 11 |
|
Responses:
201 Created
: the school was successfully created / un-hidden / un-deleted:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
409 Conflict
: the given school already exists:
1 |
|
Update One School
Used to update the given school to have a new name, address, and country.
PUT
request to /api/v1/protected/schools/:school_id
with body:
1 2 3 4 5 6 7 8 9 10 11 |
|
Responses:
200 OK
: the school was successfully updated.
Delete One School
Used to delete the specified school.
DELETE
request to /api/v1/protected/schools/:school_id
Responses:
200 OK
: the school was successfully deleted.
Hide One School
Used to mark the specified school as "hidden".
PUT
request to /api/v1/protected/schools/:school_id/hide
Responses:
200 OK
: the school was successfully updated.
Un-Hide One School
Used to mark the specified school as no longer "hidden".
PUT
request to /api/v1/protected/schools/:school_id/unhide
Responses:
200 OK
: the school was successfully updated
Get School IDs from User ID in Reports
Used to get all the schools that a user has submitted a report for.
GET
request to /api/v1/protected/schools/reports/users
Responses:
200 OK
1 2 3 4 5 6 7 8 9 10 |
|