Units

API endpoint for manage units.

Data management

/api/units

GET /storekeeper/api/units

List units

Status Codes:

Example request:

GET /storekeeper/api/units HTTP/1.1
Host: localhost:8000
Content-Type: application/json

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

[
  {
    "id": 1,
    "unit": "m"
  },
  {
    "id": 2,
    "unit": "pcs"
  }
]
POST /storekeeper/api/units

Create unit

Status Codes:

Example request:

POST /storekeeper/api/units HTTP/1.1
Host: localhost:8000
Content-Type: application/json

{
  "unit": "m"
}

Example response:

HTTP/1.0 201 CREATED
Content-Type: application/json

{
  "id": 1,
  "unit": "m"
}

/api/units/<id>

GET /storekeeper/api/units/(int: id)

Get unit

Parameters:
  • id – ID of selected unit for get
Status Codes:

Example request:

GET /storekeeper/api/units/1 HTTP/1.1
Host: localhost:8000
Content-Type: application/json

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

{
  "id": 1,
  "unit": "m"
}
PUT /storekeeper/api/units/(int: id)

Update unit

Parameters:
  • id – ID of selected unit for put
Status Codes:

Example request:

PUT /storekeeper/api/units/1 HTTP/1.1
Host: localhost:8000
Content-Type: application/json

{
  "unit": "dl"
}

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

{
  "id": 1,
  "unit": "dl"
}
DELETE /storekeeper/api/units/(int: id)

Delete unit

Parameters:
  • id – ID of selected unit for delete
Status Codes:

Example request:

DELETE /storekeeper/api/units/1 HTTP/1.1
Host: localhost:8000
Content-Type: application/json

Example response:

HTTP/1.0 200 OK
Content-Type: application/json

null