Topical is an API
api/
– API root
api/search
– The search endpoint, uses a query (?name=
or ?upc=
to go straight to a product by UPC).
api/ingredient/fuzzy/<str>/
– Gets an ingredient by any of its names; redirects to the ingredient's proper endpoint.
api/ingredient/<slug>/names
– View or change all the names of an ingredient. Allows GET
, POST
, and DELETE
methods.
{
"names": [string]
}
{
'names': [string]
}
api/ingredient/<slug>/exclude/
– Check or set whether an ingredient is excluded by the logged in user. Allows GET
, POST
, and DELETE
methods.
{ "excluded": boolean }
api/ingredient/add/
- Adds an ingredient to the list of items excluded by the logged in user. This endpoint will register a new ingredient in the database automatically if the ingredinet has not yet been created. Allows POST
method only.
{
"ingredients": [Ingredient]
}
api/ingredient/<slug>/tag/<tag_name>/
– Gets stats on how common an ingredient is for a certain tag. An important note is that tag data is only refreshed every 3 days after the last update so it won't cost as much time for repeated checks.
{
"total": int,
"matches": int,
"percent": float,
"common": boolean
}
api/ingredient/<slug>/stats/
– Gets stats on the total exclusions of an ingredient.
{
"exclusion_count": int,
"top_lists": [
{
"name": string,
"author": string,
"pk": int
}, ...
],
"top_tags": [string]
}
NOTE: top_lists
and top_tags
are limited to 5 items each.
api/product/<upc>/ingredients/
– View or change the list of ingredients on a product. Allows GET
, POST
, and DELETE
methods.
{
"name": string,
"image_url": string,
"violations": [string],
"ingredient_list": [Ingredient]
}
{ "names": [string] }
api/product/<upc>/tags/
– View or change the tags on a product. These tags are managed on the backend, so there is null-handling already in place.
{ "tags": [string] }
{ "tags": [string] }
api/me/
– gets the profile of the current user
{
"username": string,
"own_profiles": [
{
"name": string,
"pk": int
}, ...
],
"subscribed_profiles": [
{
"name": string,
"author": string,
"pk": int
}
],
"enabled_profiles": [
{
"name": string,
"pk": int,
"author": string or Undefined
}
]
}
api/user/exclusions
– gets all ingredients excluded by the user.
api/user/<username>/own_profiles/
– gets all the profiles created by a given user.
api/user/subscribed/
– gets all the profiles a given user is subscribed to.
api/user/enabled/
– gets all the profiles a given user has enabled.
{
"count": int,
"items": [
{
"name": string,
"slug": string,
"names": [string]
},
...
]
}
api/profiles/<pk>/subscribe/
– view or change whether or not the user is subscribed to a profile. Allows GET
, POST
, and DELETE
methods. POST
is used to subscribe, and DELETE
is used to unsubscribe. If the user tries to unsubscribe from a profile they own, this will return a 409 - Conflict
(instead of unsubscribing, they should be disabling or deleting their own profiles).
{
"subscribed": boolean,
"enabled": boolean
}
NOTE: "enabled"
is only present if "subscribed"
is true
.
api/profiles/<pk>/enabled/
– view or change whether or not a profile is enabled. Allows GET
, POST
, and DELETE
methods. Its GET
response body is the same as .../subscribed/
, since it literally calls it. POST
and DELETE
enable and disable a profile respectively.
api/profiles/<pk>/excludes/
– view or change the ingredients excluded by this profile. Allows GET
for all users, and allows POST
and DELETE
for the profile's author.
{
"count": int,
"ingredients": [
{
"name": string,
"slug": string,
"names": [string]
}, ...
]
}
{ "names": [string] }
{
"username": string,
"first_name": string,
"last_name": string,
"excluded_ingredients": [Ingredient]
}
{
"name": string,
"description": string,
"names": [IngredientName]
}
{
"name": string,
"upc": string,
"description": string
}
{
"url": string,
"name": string,
"description": string,
"author": User,
"excluded_ingredients": [Ingredient]
}
{
"count": int,
"results": [
{
"upc": str,
"image_url": string,
"name": string,
"violations": [
{Ingredient}, ...
]
}, ...
]
}
{
"count": int,
"results": [
{
"name": string,
"author": string,
"description": string,
"pk": int,
"exclusion_count": int
}, ...
]
}