Enter Gym

POST /gym/visit

Enter certain gym by yourself or given client. You have to be an admin to enter gym for another client.

application/json

Body Required

  • client_id string

    Id of the client in database

  • gym_id string

    Id of the gym in database

Responses

  • 200 application/json

    Successfully entering gym.

    Hide response attributes Show response attributes object
    • success boolean

      Whether you/client entered gym

    • visit_history object

      Additional properties are allowed.

      Hide visit_history attributes Show visit_history attributes object
      • visit_history_id integer

        Id of the visit in database

      • gym_id integer

        Id of the gym in database

      • entered_at string(date)

        Timestamp of entering the gym

      • left_at string(date)

        Timestamp of leaving the gym (null if still inside)

  • 400 application/json

    Validation error of given input.

    Hide response attributes Show response attributes object
    • success boolean

      Whether query is successful

    • error array[object]

      Validation error of given input.

      Hide error attributes Show error attributes object
      • code string

        Error type

      • expected string

        What was expected

      • received string

        What's the error

      • path array[string]

        What caused an error

      • message string

        Error description

  • 401 application/json

    User is not unauthorized or permissions are missing.

    Hide response attributes Show response attributes object
    • success boolean

      Whether query is successful

    • error string

      Error message

  • 429 application/json

    Rate limit exceeded - 100 queries per 15 minutes.

    Hide response attributes Show response attributes object
    • success boolean

      Whether query is successful

    • error string

      Error message

POST /gym/visit
curl \
 --request POST 'http://63.141.232.244:25540/v0/gym/visit' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"gym_id":1}'
Request example
{
  "gym_id": 1
}
Response examples (200)
{
  "success": true,
  "visit_history": {
    "gym_id": 1,
    "left_at": "2024-10-10T20:36:47Z",
    "entered_at": "2024-10-10T18:36:47Z",
    "visit_history_id": 1
  }
}
Response examples (400)
{
  "success": false,
  "error": [
    {
      "code": "invalid_type",
      "expected": "string",
      "received": "undefined",
      "path": [
        "client_id"
      ],
      "message": "Required"
    }
  ]
}
Response examples (401)
{
  "success": false,
  "error": "Unauthorized"
}
Response examples (429)
{
  "success": false,
  "error": "Too many requests, please try again later"
}