Skip to content

Latest commit

 

History

History
672 lines (436 loc) · 7.88 KB

api-documentation.md

File metadata and controls

672 lines (436 loc) · 7.88 KB

API Routes

  • All routes except the login route receive a token via headers.

Authentication

POST: /login

  JSON body

  {
    "email": "string",
    "password": "string"
  }

Dashboard

GET: /v1/dashboard/:days

  PARAMS

  days: number (filter data by the number of days)

Categories

POST: /v1/categories

  JSON body
  
  {
    "title": "string"
  }

PUT: /v1/categories/:id

  PARAMS

  id: string (category id)

  JSON body

  {
    "title": "string"
  }

GET: /v1/categories

  Return all categories

GET: /v1/categories/:id

  PARAMS

  id: string (return just one category)

DEL: /v1/categories/:id

  PARAMS

  id: string (delete just one category)

Carriers

POST: /v1/carriers

  JSON body
  
  {
    "name": "string",
    "region": "string"
  }

PUT: /v1/carriers/:id

  PARAMS

  id: string (carrier id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/carriers/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all carriers or filtered carriers if you pass query params.

GET: /v1/carriers/:id

  PARAMS

  id: string (return just one carrier)

DEL: /v1/carriers/:id

  PARAMS

  id: string (delete just one carrier)

Stores

POST: /v1/stores

  JSON body
  
  {
    "name": "string",
    "type": "string"
  }

PUT: /v1/stores/:id

  PARAMS

  id: string (store id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/stores/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all stores or filtered stores if you pass query params.

GET: /v1/stores/:id

  PARAMS

  id: string (return just one store)

DEL: /v1/stores/:id

  PARAMS

  id: string (delete just one store)

Providers

POST: /v1/providers

  JSON body
  
  {
    "name": "string",
    "email": "string",
    "tel": "string"
  }

PUT: /v1/providers/:id

  PARAMS

  id: string (provider id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/providers/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all providers or filtered providers if you pass query params.

GET: /v1/providers/:id

  PARAMS

  id: string (return just one provider)

DEL: /v1/providers/:id

  PARAMS

  id: string (delete just one provider)

Users

POST: /v1/users

  JSON body
  
  {
    "name": "string",
    "email": "string",
    "unity": "string", (store id)
    "position": "string"
  }

PUT: /v1/users/:id

  PARAMS

  id: string (user id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/users/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all users or filtered users if you pass query params.

GET: /v1/users/:id

  PARAMS

  id: string (return just one user)

DEL: /v1/users/:id

  PARAMS

  id: string (delete just one user)

Products

POST: /v1/products

  JSON body
  
  {
    "name": "string",
    "description": "string",
    "purchase_price": number,
    "sale_price": number,
    "category": "string", (category id)
    "unity": "string", (store id)
    "provider": "string", (provider id)
    "lot": number,
    "validity": "string", (date on format yyyy-mm-dd)
    "quantity": number
  }

PUT: /v1/products/:id

  PARAMS

  id: string (product id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/products/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all products or filtered products if you pass query params.

GET: /v1/products/:id

  PARAMS

  id: string (return just one product)

DEL: /v1/products/:id

  PARAMS

  id: string (delete just one product)

Sellers

POST: /v1/sellers

  JSON body
  
  {
    "user": "string", (user id)
    "comission": number
  }

PUT: /v1/sellers/:id

  PARAMS

  id: string (seller id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/sellers/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all sellers or filtered sellers if you pass query params.

GET: /v1/sellers/:id

  PARAMS

  id: string (return just one seller)

DEL: /v1/sellers/:id

  PARAMS

  id: string (delete just one seller)

Clients

POST: /v1/clients

  JSON body
  
  {
    "name": "string",
    "email": "string",
    "tel": "string",
    "cep": "string",
    "city": "string",
    "state": "string",
    "unity": "string" (store id)
  }

PUT: /v1/clients/:id

  PARAMS

  id: string (client id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/clients/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all clients or filtered clients if you pass query params.

GET: /v1/clients/:id

  PARAMS

  id: string (return just one client)

DEL: /v1/clients/:id

  PARAMS

  id: string (delete just one client)

Tickets

POST: /v1/tickets

  JSON body
  
  {
    "title": "string",
    "description": "string",
    "unity": "string" (store id)
  }

PUT: /v1/tickets/:id

  PARAMS

  id: string (ticket id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/tickets/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all tickets or filtered tickets if you pass query params.

GET: /v1/tickets/:id

  PARAMS

  id: string (return just one ticket)

DEL: /v1/tickets/:id

  PARAMS

  id: string (delete just one ticket)

Financial

POST: /v1/financial/registers

  JSON body
  
  {
    "type": number, (0 for output and 1 for input)
    "unity": "string", (store id)
    "value": number
  }

PUT: /v1/financial/registers/:id

  PARAMS

  id: string (register id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/financial/register/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all registers or filtered registers if you pass query params.

GET: /v1/financial/registers/:id

  PARAMS

  id: string (return just one register)

DEL: /v1/financial/registers/:id

  PARAMS

  id: string (delete just one register)

Purchases

POST: /v1/purchases

  JSON body
  
  {
    "unity": "string", (store id)
    "provider": "string", (provider id)
    "product": "string", (product id)
    "quantity": number,
    "unit_price": number
  }

PUT: /v1/purchases/:id

  PARAMS

  id: string (product id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/purchases/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all purchases or filtered purchases if you pass query params.

GET: /v1/purchases/:id

  PARAMS

  id: string (return just one purchase)

DEL: /v1/purchases/:id

  PARAMS

  id: string (delete just one purchase)

Sales

POST: /v1/sales

  JSON body
  
  {
    "product": "string", (product id)
    "unity": "string", (store id)
    "client": "string", (client id)
    "seller": "string", (seller id)
    "carrier": "string", (carrier id)
    "quantity": number
  }

PUT: /v1/sales/:id

  PARAMS

  id: string (sale id)

  JSON body

  Same data as POST route, but optional.

GET: /v1/sales/?page=&q=

  Query PARAMS

  page: next page to pagination
  q: text to search

  Return all sales or filtered sales if you pass query params.

GET: /v1/sales/:id

  PARAMS

  id: string (return just one sale)

DEL: /v1/sales/:id

  PARAMS

  id: string (delete just one sale)