Equipment Types

GET /api/equipment-types

Get all types of equipment

Scope: equipments:read

Example request:

GET /api/equipment-types HTTP/1.1
Content-Type: application/json

Example response:

  • for non admin user :

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

{
  "data": {
    "equipment_types": [
      {
        "id": 1,
        "is_active": true,
        "label": "Shoe"
      },
      {
        "id": 2,
        "is_active": true,
        "label": "Bike"
      },
      {
        "id": 3,
        "is_active": true,
        "label": "Bike Trainer"
      },
      {
        "id": 4,
        "is_active": true,
        "label": "Kayak_Boat"
      },
      {
        "id": 5,
        "is_active": true,
        "label": "Skis"
      },
      {
        "id": 5,
        "is_active": true,
        "label": "Snowshoes"
      }
    ]
  },
  "status": "success"
}
  • for admin user :

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

{
  "data": {
    "equipment_types": [
      {
        "has_equipments": true,
        "id": 1,
        "is_active": true,
        "label": "Shoe"
      },
      {
        "has_equipments": true,
        "id": 2,
        "is_active": true,
        "label": "Bike"
      },
      {
        "has_equipments": false,
        "id": 3,
        "is_active": true,
        "label": "Bike Trainer"
      },
      {
        "has_equipments": false,
        "id": 4,
        "is_active": true,
        "label": "Kayak_Boat"
      },
      {
        "has_equipments": false,
        "id": 5,
        "is_active": true,
        "label": "Skis"
      },
      {
        "has_equipments": false,
        "id": 6,
        "is_active": true,
        "label": "Snowshoes"
      }
    ]
  },
  "status": "success"
}
Request Headers:
Status Codes:
  • 200 OK – success

  • 401 Unauthorized

    • provide a valid auth token

    • signature expired, please log in again

    • invalid token, please log in again

  • 403 Forbiddenyou do not have permissions

GET /api/equipment-types/(int: equipment_type_id)

Get a type of equipment

Scope: equipments:read

Example request:

GET /api/equipment-types/2 HTTP/1.1
Content-Type: application/json

Example response:

  • success for non admin user :

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

{
  "data": {
    "equipment_types": [
      {
        "id": 2,
        "is_active": true,
        "label": "Bike"
      }
    ]
  },
  "status": "success"
}
  • success for admin user :

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

{
  "data": {
    "equipment_types": [
      {
        "has_equipments": true,
        "id": 2,
        "is_active": true,
        "label": "Bike"
      }
    ]
  },
  "status": "success"
}
  • equipment type not found

HTTP/1.1 404 NOT FOUND
Content-Type: application/json

{
  "status": "not found",
  "data": {
    "equipment_types": []
  }
}
Parameters:
  • equipment_type_id (integer) – equipment type id

Request Headers:
Status Codes:
PATCH /api/equipment-types/(int: equipment_type_id)

Update a type of equipment to (de)activate it.

Authenticated user must be an admin.

Scope: equipments:write

Example request:

PATCH /api/equipment-types/2 HTTP/1.1
Content-Type: application/json

Example response:

  • success :

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

{
  "data": {
    "equipment_types": [
      {
        "has_equipments": true,
        "id": 2,
        "is_active": true,
        "label": "Bike"
      }
    ]
  },
  "status": "success"
}
Parameters:
  • equipment_type_id (integer) – equipment type id

Request JSON Object:
  • is_active (boolean) – equipment type active status

Request Headers:
Status Codes: