Ir para o conteúdo principal

Categorias

Listar, criar, renomear, ordenar e excluir as categorias do cardápio, e ordenar seus produtos.

Cada operação traz seu curl e sua resposta de exemplo; as chaves e os ids dos exemplos são fictícios. Os campos marcados com * são obrigatórios.

List the categories

get/restaurants/{ref}/categoriesrequer menu:readlistCategories

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants

Exemplo

curl -X GET "https://delimenu.co/api/v1/restaurants/pizzeria-roma/categories" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Resposta 200

{
  "categories": [
    {
      "id": "k3Qm8vXb2LpN7wRt1YaZ",
      "name": "Pizzas",
      "position": 1
    },
    {
      "id": "c7Wd2Bn5Kq9Xr4Ms8Lt1",
      "name": "Bebidas",
      "position": 2
    }
  ]
}

Campos da resposta

CampoTipoDescrição
categories*object[]
id*string
name*string
translationsobjectThe name in other languages, keyed by language code, e.g. { "en": { "name": "Large" } }. Absent when nothing is translated; a language missing here falls back to `name`.
esobject
namestring
enobject
namestring
ptobject
namestring
frobject
namestring
deobject
namestring
itobject
namestring
position*integermin -9007199254740991 · max 9007199254740991

Erros

  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 500 INTERNAL — something failed on our side; retry in a moment

Create a category

post/restaurants/{ref}/categoriesrequer menu:writecreateCategory

Adds a category at the end of the menu. name is in the menu's primary language; translations carries it in the others.

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants

Corpo (JSON)

CampoTipoDescrição
name*stringCategory nameaté 50 caracteres
translationsobjectThe category name in the menu's other languages, e.g. { "en": { "name": "Drinks" } }. Keyed by language code (es, en, pt, fr, de, it). Shown to diners who read the menu in that language; a language without a translation falls back to the original text, and an entry in the menu's primary language is ignored. Replaces the whole map when provided; {} removes every translation.
esobject
namestringThe name in that languageaté 50 caracteres
enobject
namestringThe name in that languageaté 50 caracteres
ptobject
namestringThe name in that languageaté 50 caracteres
frobject
namestringThe name in that languageaté 50 caracteres
deobject
namestringThe name in that languageaté 50 caracteres
itobject
namestringThe name in that languageaté 50 caracteres

Exemplo

curl -X POST "https://delimenu.co/api/v1/restaurants/pizzeria-roma/categories" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Postres","translations":{"en":{"name":"Desserts"}}}'

Resposta 201

{
  "category": {
    "id": "d4Fg6Hj8Kl0Zx2Cv4Bn6",
    "name": "Postres",
    "translations": {
      "en": {
        "name": "Desserts"
      }
    }
  }
}

Campos da resposta

CampoTipoDescrição
category*object
id*string
name*string
translationsobjectThe name in other languages, keyed by language code, e.g. { "en": { "name": "Large" } }. Absent when nothing is translated; a language missing here falls back to `name`.
esobject
namestring
enobject
namestring
ptobject
namestring
frobject
namestring
deobject
namestring
itobject
namestring

Erros

  • 400 VALIDATION — a field is missing or malformed; `issues` names it
  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 409 CONFLICT — a category with that name already exists
  • 500 INTERNAL — something failed on our side; retry in a moment

Reorder the categories

put/restaurants/{ref}/category-orderrequer menu:writereorderCategories

Sets the display order. Pass every category id exactly once, in the new order.

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants

Corpo (JSON)

CampoTipoDescrição
category_ids*string[]Every category id exactly once, in the new display order

Exemplo

curl -X PUT "https://delimenu.co/api/v1/restaurants/pizzeria-roma/category-order" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"category_ids":["c7Wd2Bn5Kq9Xr4Ms8Lt1","k3Qm8vXb2LpN7wRt1YaZ"]}'

Resposta 200

{
  "order_categories": [
    "c7Wd2Bn5Kq9Xr4Ms8Lt1",
    "k3Qm8vXb2LpN7wRt1YaZ"
  ]
}

Campos da resposta

CampoTipoDescrição
order_categories*string[]

Erros

  • 400 VALIDATION — a field is missing or malformed; `issues` names it
  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 500 INTERNAL — something failed on our side; retry in a moment

Rename or translate a category

patch/restaurants/{ref}/categories/{id}requer menu:writeupdateCategory

Pass name, translations or both; what is not passed is left as it is. translations replaces the whole map, and {} removes every translation.

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants
id*caminhoThe category id, from GET /restaurants/{ref}/categories

Corpo (JSON)

CampoTipoDescrição
namestringCategory nameaté 50 caracteres
translationsobjectThe category name in the menu's other languages, e.g. { "en": { "name": "Drinks" } }. Keyed by language code (es, en, pt, fr, de, it). Shown to diners who read the menu in that language; a language without a translation falls back to the original text, and an entry in the menu's primary language is ignored. Replaces the whole map when provided; {} removes every translation.
esobject
namestringThe name in that languageaté 50 caracteres
enobject
namestringThe name in that languageaté 50 caracteres
ptobject
namestringThe name in that languageaté 50 caracteres
frobject
namestringThe name in that languageaté 50 caracteres
deobject
namestringThe name in that languageaté 50 caracteres
itobject
namestringThe name in that languageaté 50 caracteres

Exemplo

curl -X PATCH "https://delimenu.co/api/v1/restaurants/pizzeria-roma/categories/k3Qm8vXb2LpN7wRt1YaZ" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Pizzas artesanales"}'

Resposta 200

{
  "category": {
    "id": "k3Qm8vXb2LpN7wRt1YaZ",
    "name": "Pizzas artesanales"
  }
}

Campos da resposta

CampoTipoDescrição
category*object
id*string
name*string
translationsobjectThe name in other languages, keyed by language code, e.g. { "en": { "name": "Large" } }. Absent when nothing is translated; a language missing here falls back to `name`.
esobject
namestring
enobject
namestring
ptobject
namestring
frobject
namestring
deobject
namestring
itobject
namestring

Erros

  • 400 VALIDATION — a field is missing or malformed; `issues` names it
  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 500 INTERNAL — something failed on our side; retry in a moment

Delete a category

delete/restaurants/{ref}/categories/{id}requer menu:writedeleteCategory

Refused with 409 while the category still has products, unless delete_products is true, in which case the products are deleted too.

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants
id*caminhoThe category id, from GET /restaurants/{ref}/categories
delete_productsqueryDelete the products in the category too. Without it a non-empty category is refused with 409.

Exemplo

curl -X DELETE "https://delimenu.co/api/v1/restaurants/pizzeria-roma/categories/k3Qm8vXb2LpN7wRt1YaZ?delete_products=true" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Resposta 200

{
  "deleted": "k3Qm8vXb2LpN7wRt1YaZ",
  "deleted_products": 3
}

Campos da resposta

CampoTipoDescrição
deleted*string
deleted_products*integermin -9007199254740991 · max 9007199254740991

Erros

  • 400 VALIDATION — a field is missing or malformed; `issues` names it
  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 409 CONFLICT — the category still has products
  • 500 INTERNAL — something failed on our side; retry in a moment

Reorder the products of a category

put/restaurants/{ref}/categories/{id}/product-orderrequer menu:writereorderProducts

Pass every product id of that category exactly once, in the new order.

Parâmetros

NomeOndeDescrição
ref*caminhoThe restaurant identifier (the slug in its public URL, e.g. "pizzeria-roma") or its id, as returned by GET /restaurants
id*caminhoThe category id, from GET /restaurants/{ref}/categories

Corpo (JSON)

CampoTipoDescrição
product_ids*string[]Every product id of the category exactly once, in the new display order

Exemplo

curl -X PUT "https://delimenu.co/api/v1/restaurants/pizzeria-roma/categories/k3Qm8vXb2LpN7wRt1YaZ/product-order" \
  -H "Authorization: Bearer dmk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"product_ids":["q2Jk5Lm8Np1Qr4St7Uv0","p9Hs4TqL2mNc8VbX6Rdy"]}'

Resposta 200

{
  "category_id": "k3Qm8vXb2LpN7wRt1YaZ",
  "order_products": [
    "q2Jk5Lm8Np1Qr4St7Uv0",
    "p9Hs4TqL2mNc8VbX6Rdy"
  ]
}

Campos da resposta

CampoTipoDescrição
category_id*string
order_products*string[]

Erros

  • 400 VALIDATION — a field is missing or malformed; `issues` names it
  • 401 UNAUTHORIZED — the key is missing, unknown or revoked
  • 402 NOT_PREMIUM — the restaurant has no active subscription or trial
  • 403 FORBIDDEN — the key lacks the scope this endpoint needs
  • 404 NOT_FOUND — no such restaurant in this account, or no such item in it
  • 500 INTERNAL — something failed on our side; retry in a moment

Desenvolvedores