Skip to content

Gastronomycon API v1.0 reference

Ugo Briasco edited this page Feb 3, 2019 · 3 revisions

The current api endpoint is: https://api.gastronomycon.io/v1.0

GET /grocery

Lists groceries

Implementation notes

Returns a list of groceries that match certain criteria.

Request

Headers

Key Value DataType Description
Content-Type application/json String Optional parameter.
x-api-key YOUR_API_KEY String Mandatory parameter.

Parameters

Parameter Value DataType Description
name e.g. 'garlic' String Name of the grocery to queried.
lang e.g. 'en_GB' String Defines the language of the given 'name' to be queried. This is a mandatory parameter, if the patameter 'name' is used.
category e.g. 'vegetable' String Defines the category of the grocery. It can be used as unique parameter or in combination with others.
translate e.g. 'de_DE' Array Filters the response by a given set of languages
id e.g. '5bcc73beff6bf516e991c507' String Returns a sigle grocery by its ID. This parameter will be probably deprecated soon.
primaryName e.g. 'garlic' String Returns the given grocery and all its variations. This parameter needs to match exactly the one in the database.

Response

{
    data: [
        {
            en_GB:{
                name: String
                gen: String
            },
            category: String,
            primaryName: String
        }
    ]
    count: Number
}

Example

Requesting all the en_GB terms matching 'garlic', with translation in German and Italian.

curl -g -H 'Content-Type: application/json' -H 'x-api-key: YOUR_API_KEY' 'https://api.gastronomycon.io/v1.0/grocery?lang=en_GB&name=garlic&translate[]=en_GB&translate[]=it_IT&translate[]=de_DE'

Response:

{
    "data": [
        {
            "en_GB": {
                "name": "garlic",
                "gen": "n"
            },
            "it_IT": {
                "name": "aglio",
                "gen": "m"
            },
            "de_DE": {
                "name": "Knoblauch",
                "gen": "m"
            },
            "category": "vegetable",
            "primaryName": "garlic"
        },
        {
            "en_GB": {
                "name": "fresh garlic",
                "gen": "n"
            },
            "it_IT": {
                "name": "aglio fresco",
                "gen": "m"
            },
            "de_DE": {
                "name": "frischer Knoblauch",
                "gen": "m"
            },
            "category": "vegetable",
            "primaryName": "garlic"
        }
    ],
    "count": 2
Clone this wiki locally