Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.01 KB

exp.md

File metadata and controls

63 lines (39 loc) · 1.01 KB

API Reference: Exp

The expiration API lets you search for expiration dates

Search

Used to find an expiration date given an ingredient keyword

URL : /v1/exp?ingredient=<ingredient>

Methods : GET

Auth required : YES

Data constraints

ingredient in querystring is passed as plaintext (url-encoded, if necessary), no quotes

Data example

GET <ip>/v1/exp?ingredient=raw%20chicken

Success Response

Code : 200 OK

Content example

{
	"freezer_expiration": "2021-05-23",
	"fridge_expiration": "2021-05-02",
	"pantry_expiration": "2021-04-23",
	"ingredient_name": "raw chicken"
}

Error Response

Condition : If wasn't passed in the querystring

Code : 400 BAD REQUEST

Content :

{
    "error": "no ingredient was passed"
}

Condition : If an expiration date couldn't be found or returned from the database

Code : 404 NOT FOUND

Content :

{
    "error": "Expiration date could not be retrieved"
}