Locations

Endpoints for managing location resources.

GET /api/locations

  • Description: Retrieves a list of all locations.

  • Parameters: None

  • Example Request:

    GET /api/locations
  • Response:

    • 200 OK: Returns an array of location objects.

    • 4XX/5XX: Returns an error message if the request fails.

GET /api/locations/{id}

  • Description: Retrieves details of a specific location by ID.

  • Parameters:

    • id (integer): ID of the location.

  • Example Request:

    GET /api/locations/1
  • Response:

    • 200 OK: Returns the location object.

    • 404 Not Found: If the location with the specified ID does not exist.

    • 4XX/5XX: Returns an error message if the request fails.

POST /api/locations

  • Description: Creates a new location.

  • Parameters: None (Data is sent in the request body)

  • Request Body:

  • Example Request:

  • Response:

    • 201 Created: Returns the created location object.

    • 4XX/5XX: Returns an error message if the request fails.

PUT /api/locations/{id}

  • Description: Updates an existing location by ID.

  • Parameters:

    • id (integer): ID of the location.

  • Request Body:

  • Example Request:

  • Response:

    • 200 OK: Returns the updated location object.

    • 404 Not Found: If the location with the specified ID does not exist.

    • 4XX/5XX: Returns an error message if the request fails.

DELETE /api/locations/{id}

  • Description: Deletes a location by ID.

  • Parameters:

    • id (integer): ID of the location.

  • Example Request:

  • Response:

    • 200 OK: Confirmation of deletion.

    • 404 Not Found: If the location with the specified ID does not exist.

    • 4XX/5XX: Returns an error message if the request fails.

Last updated