Read Inspection

GET /reports/inspections/:id

Path parameters

  • id: The created timestamp of the Inspection you want to see.

Status codes

  • 200 on success
  • 404 if the inspection was not found

Response properties

The response format is JSON with the following properties:

  • created: Created timestamp, also functions as the id.
  • settled: Timestamp for when the last modification was performed on the inspection.
  • counted_items: Number of items in the report.
  • report: Report data.
  • area: The area the inspection has taken place.
  • location: The site or location where the area is located. (optional)

Example response:

{
  "created": 1698071359457,
  "settled": 1698071359457,
  "counted_items": 1,
  "report": [
    {
      "item": {
        "id": "itm_2WAT2AbCe6",
        "category": {
          "id": "cat_85WFjud-JW",
          "name": "07 Obst / Gemüse"
        },
        "name": "Blattsalatmix ententanz 0,5kg",
        "vessel": {
          "size": 1,
          "unit": "quantity"
        },
        "order_by": "vessel",
        "price": 275,
        "supplier": {
          "id": 1698063590334,
          "name": "CF Gastro",
          "reference": "21993092"
        }
      },
      "stock": [
        {
          "price": 275,
          "value": 275,
          "normalised": 1,
          "count": 1
        }
      ],
      "total": {
        "price": 275,
        "value": 275,
        "normalised": 1,
        "count": 1
      }
    }
  ],
  "area": {
    "id": "l14",
    "name": "Kühlung"
  },
  "location": {
    "id": "div_HlkuLAdFcM",
    "name": "Zürich HB",
    "cost_center": "CH00099ZHB"
  }
}
Report

The report data is an array of the counted items. Each record consits of 3 parts:

  1. item
  2. stock
  3. total
1. Item

This section contains the general details of the item. These include supplier, category, vessel and pricing information.

Example:

{
  "id": "00-001",
  "category": {
    "id": "cat_KaNDv5-h73",
    "name": "Food"
  },
  "name": "Porcini Mushrooms",
  "vessel": {
    "size": 1,
    "unit": "kg"
  },
  "order_by": "kg",
  "price": 2590,
  "supplier": {
    "id": 1684999886771,
    "name": "Fresh Shop",
    "reference": "MR-porcini-77"
  }
}
2. Stock

The stock is represented as a queue containing counts at different price points. Counts are represented in both human readable and normalised values.

Each stock queue item contains the following properties:

  • price: Price of one vessel in cents (1250 = €12.50).
  • value: Price multiplied by the number of vessels, or the total value of this stock queue item in cents.
  • normalised: The weight / volume / count of the item. Depending on the vessel, it is in g / ml / pieces.
  • count: The count of full vessels
  • fraction: The fractional count, represented as an object of amount and unit. (optional)

Example:

[
  {
    "price": 3120,
    "value": 31200,
    "normalised": 10000,
    "count": 10
  },
  {
    "price": 3120,
    "value": 105300,
    "normalised": 33750,
    "count": 33,
    "fraction": {
      "amount": 0.75,
      "unit": "kg"
    }
  }
]
3. Total

To simplify calculations the report also contains a total segment, where all the stock is added up. It also contains the rounded average price - it is the total value divided by the total count, rounded to cents.

The total for the above stock example:

{
  "price": 3120,
  "value": 136500,
  "normalised": 43750,
  "count": 43,
  "fraction": {
    "amount": 0.75,
    "unit": "kg"
  }
}