Mock API for use in development of TUTV.
This is a nonfunctional dummy API that will provide "fake" API responses appropriate for use
during front-end development.
Lists all equipment in the inventory regardless of availability at a given time. Does not require authentication.
Lists a subset of the equipment catalog, filtered by one or more search parameters. Does not require authentication. The search parameters accepted are as follows:
parameter | example usage | description |
---|---|---|
q | ?q=Camera |
Searches the catalog for items that match a search term |
startDate/endDate | ?startDate=123&endDate=456 |
Restricts the number of available items by what is available in a given time range. |
category | ?category=microphone |
Restricts the search results to items with a certain category ID |
GET /api/v1/equipment/search?q=XLR&startDate=123&endDate=456&category=microphone
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 10 Dec 2019 21:59:50 GMT
X-Powered-By: Express
{
"data": [
{
"name": "XLR-XLR Cable (10ft)",
"slug": "xlr-xlr-cable-10ft",
"available_count": 1,
"total_count": 4,
"image": null
},
{
"name": "XLR-XLR Cable (15ft)",
"slug": "xlr-xlr-cable-15ft",
"available_count": 2,
"total_count": 2,
"image": null
}
]
}
Returns information about the authenticated user.
Returns a summary of the authenticated user’s active requests.
GET /api/v1/user/requests/overview
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Tue, 10 Dec 2019 22:43:40 GMT
X-Powered-By: Express
{
"data": [
{
"start_date": "2019-12-14T19:08:04.186Z",
"end_date": "2019-12-18T19:08:04.186Z",
"name": "A Lover's Quarrel",
"id": "t5ljqk",
"equipment_count": 2
},
{
"start_date": "2019-12-08T19:08:04.186Z",
"end_date": "2019-12-11T19:08:04.186Z",
"name": "Athena Project",
"id": "s9eq6z",
"equipment_count": 3
},
{
"start_date": "2019-10-14T19:08:04.186Z",
"name": "Bosfeed",
"id": "lnj1e7",
"equipment_count": 2
}
]
}
Returns more detailed information about a specific user request.
Some routes in the API require authentication. To make developing the front-end alongside this API easier, this mock API will return full and correct data for all requests, regardless of authentication. However, requests to protected endpoints that are made without the proper credentials will return status 403
alongside the data requested, and add an error message to the response.
This behavior is intended to provide a reminder that the real API will have strict authentication requirements, while at the same time allowing rapid front-end development unhindered by hard-to-implement authentication requirements.
To make an authenticated request, include an Authorization
header with a valid JSON Web Token (JWT).
Accept: */*
Cache-Control: no-cache
Connection: keep-alive
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbl91c2VyIiwibmFtZSI6IkFkbWluIFVzZXIiLCJpYXQiOjE1NzYwMTA5Mzh9.2lqotAo24DOySIP8U0dNaxm_jB_-ATQQ2CwD6ZgNLzw
In the real app, JSON web tokens will be issued securely. However, for the purpose of this mock API, JSON web tokens can be obtained by the following two token endpoints:
/api/v1/token_obtain/user/
will return a JWT representing a normal user/api/v1/token_obtain/admin/
will return a JWT for an admin user.
The JSON web tokens that this endpoint returns will allow access to authenticated routes while suppressing the 403 Forbidden
warning. The tokens are valid for 24 hours, after which clients should request a new token for future requests.