Skip to main content
GET
/
sales
List Sales
curl --request GET \
  --url https://api.example.com/sales
{
  "error": true,
  "data": [
    {
      "idSales": "<string>",
      "idSalesDetails": "<string>",
      "clientsId": "<string>",
      "clientsName": "<string>",
      "idProduct": "<string>",
      "nameProduct": "<string>",
      "quantity": 123,
      "price": "<string>",
      "total": "<string>"
    }
  ]
}
This endpoint returns a comprehensive list of all sale details, including information about the products, clients, quantities, prices, and totals. Each row represents a product within a sale.

Response Format

The response includes detailed information from joined tables (sales, sale_details, clients, and products).

Response Fields

error
boolean
Indicates if an error occurred
data
array
Array of sale detail objects

Response Example

{
  "error": false,
  "data": [
    {
      "idSales": "4e42fc03-edf3-4212-afb5-47e9ae8400a4",
      "idSalesDetails": "1b71fff6-ca67-424d-a391-f14b0a63d8ec",
      "clientsId": "036c71c5-14e0-11f1-9fcd-2418c6c96a00",
      "clientsName": "Mark Zuckemberg",
      "idProduct": "1eeeaded-14e6-11f1-9fcd-2418c6c96a00",
      "nameProduct": "Ptusas",
      "quantity": 30,
      "price": "1200.00",
      "total": "36000.00"
    },
    {
      "idSales": "878d89a7-a1a1-4411-a359-1ad08965fb30",
      "idSalesDetails": "4033e9a1-5858-44c9-b1d7-39c718933372",
      "clientsId": "036c71c5-14e0-11f1-9fcd-2418c6c96a00",
      "clientsName": "Mark Zuckemberg",
      "idProduct": "1373fe00-14e4-11f1-9fcd-2418c6c96a00",
      "nameProduct": "Coca cola",
      "quantity": 10,
      "price": "3000.00",
      "total": "30000.00"
    },
    {
      "idSales": "4e42fc03-edf3-4212-afb5-47e9ae8400a4",
      "idSalesDetails": "bc7ff6f2-d092-46fa-a893-71c860c2a69d",
      "clientsId": "036c71c5-14e0-11f1-9fcd-2418c6c96a00",
      "clientsName": "Mark Zuckemberg",
      "idProduct": "2cfba483-14e6-11f1-9fcd-2418c6c96a00",
      "nameProduct": "Pepsi",
      "quantity": 50,
      "price": "5000.00",
      "total": "250000.00"
    }
  ]
}

Understanding the Response

  • Multiple rows per sale: If a sale includes multiple products, each product appears as a separate item in the array with the same idSales but different idSalesDetails.
  • Price snapshot: The price field reflects the product’s price at the time of sale, which may differ from the current product price.
  • Calculated totals: The total field is automatically calculated as price × quantity.

Build docs developers (and LLMs) love