Skip to content

API DOCUMENTATION

Bruno Pinho edited this page Jun 18, 2021 · 8 revisions

API Documentation πŸ“–

​ Author : Bruno Gomes de Oliveira Pinho


πŸ“Œ USER

POST: https://bruno-lanches.herokuapp.com/users

To insert a user you will need to enter the attributes below.

Note :

  • The CPF field must be entered correctly.
  • The Phone number filed must be entered correctly.
  • The Date format must be entered like 'dd/MM/yyyy'.
  • The Email field must be a valid email.
{
		 "name": "bruno",
	        "phone": "75981395179",
                "email": "bruno@gmail.com",
		"cpf":"999.999.999-99",
	        "date": "21/11/1980",
		"address": "Avenida 1234,Condominio A",
		"number": "Casa 90"
    }

PUT: https://bruno-lanches.herokuapp.com/users/updated

To update a user you will need to enter the User 'id' and pass the new parameter values.

Note :

  • The CPF field must be entered correctly.
  • The Phone number filed must be entered correctly.
  • The Date format must be entered like 'dd/MM/yyyy'.
{		
    
         "id":1,
	 "name": "bruno",
	 "phone": "75981395179",
         "email": "bruno@gmail.com",
         "cpf":"999.999.999-99",
         "date": "21/11/1980",
         "address": "Avenida 1234,Condominio A",
	 "number": "Casa 90"
	
}

DELETE: https://bruno-lanches.herokuapp.com/users/1/removed

To delete a user you will need to enter the User 'id'.

Note :

  • The 'id' MUST exists.

GET: https://bruno-lanches.herokuapp.com/users

List all users by birth date

[    
   {
   "id": 1,
   "name": "Bruno",
   "phone": "75981395179",
   "email": "bruno@gmail.com",
   "date": "1980-11-21",
   "address": "Avenida 1234,Condominio A",
   "number": "Casa 90"
 }
]

GET: https://bruno-lanches.herokuapp.com/users/bruno/found

List user by name

Note :

  • Your first name letter will be set to UpperCase().

      {
      "id": 1,
      "name": "Bruno",
      "phone": "75981395179",
      "email": "bruno@gmail.com",
      "date": "1980-11-21",
      "address": "Avenida 1234,Condominio A",
      "number": "Casa 90"
    }

GET: https://bruno-lanches.herokuapp.com/users/1/orders

List all orders of the User id

Note :

  • The 'id' MUST exists.
{
    "id": 1,
    "cpf":"999.999.999-99",
    "orders": [
      {
        "id": 1,
        "moment": "2021-06-17T12:39:48Z",
        "status": "PENDING",
        "client_name": "Bruno",
        "client_phone": "75981395179",
        "address": "Avenida 1234,Condominio A",
        "number": "Casa 90"
        "deliveryman_name":  "marcos",
        "deliveryman_phone": "75981395174",
        "products": [
          {
            "id": 4,
            "name": "MOZZARELLA PIZZA",
            "description": "A DELICIOUS MOZZARELLA PIZZA MADE WITH THE BEST INGREDIENTS",
            "price": 15.0,
            "categories": [
              {
                "id": 2,
                "name": "PIZZA"
              }
            ]
          }
        ]
      }
    ]
  }
  

GET: https://bruno-lanches.herokuapp.com/users/1/orders/status/delivered

List all delivered orders of the user id

Note :

  • The 'id' MUST exists.
  {
    "id": 1,
   "cpf":"999.999.999-99",
    "orders": [
      {
        "id": 1,
        "moment": "2021-06-17T12:39:48Z",
        "status": "DELIVERED",
        "client_name": "Bruno",
        "client_phone": "75981395179",
        "address": "Avenida 1234,Condominio A",
        "number": "Casa 90"
        "deliveryman_name":  "marcos",
        "deliveryman_phone": "75981395174",
        "products": [
          {
            "id": 4,
            "name": "MOZZARELLA PIZZA",
            "description": "A DELICIOUS MOZZARELLA PIZZA MADE WITH THE BEST INGREDIENTS",
            "price": 15.0,
            "categories": [
              {
                "id": 2,
                "name": "PIZZA"
              }
            ]
          }
        ]
      }
    ]
  }

GET: https://bruno-lanches.herokuapp.com/users/1/orders/status/pending

List all pending orders of the user id

Note :

  • The 'id' MUST exists.
  {
    "id": 1,
   "cpf":"999.999.999-99",
    "orders": [
      {
        "id": 1,
        "moment": "2021-06-17T12:39:48Z",
        "status": "PENDING",
        "client_name": "Bruno",
        "client_phone": "75981395179",
        "address": "Avenida 1234,Condominio A",
        "number": "Casa 90"
        "deliveryman_name":  "marcos",
        "deliveryman_phone": "75981395174",
        "products": [
          {
            "id": 4,
            "name": "MOZZARELLA PIZZA",
            "description": "A DELICIOUS MOZZARELLA PIZZA MADE WITH THE BEST INGREDIENTS",
            "price": 15.0,
            "categories": [
              {
                "id": 2,
                "name": "PIZZA"
              }
            ]
          }
        ]
      }
    ]
  }

πŸ“Œ Deliveryman πŸ”¨ [building...]