POST /api/rooms/{roomId}/discounts

Sample request:

POST /rooms/{roomId}/discounts { "Percentage": 20 "StartDate": "2024-02-0200:00:00", "EndDate": "2024-03-03T00:00:00" }

Path parameters

  • roomId string(uuid) Required

    The id of the room

Body

The data for the new discount

  • percentage number(double) | null

    Percentage of the discount for the room

  • discountedPrice number(double) | null

    Discounted price for the room

  • startDate string(date-time)

    Discount start date in UTC

  • endDate string(date-time)

    Discount end date in UTC

  • Additional properties are NOT allowed

Body

The data for the new discount

  • percentage number(double) | null

    Percentage of the discount for the room

  • discountedPrice number(double) | null

    Discounted price for the room

  • startDate string(date-time)

    Discount start date in UTC

  • endDate string(date-time)

    Discount end date in UTC

  • Additional properties are NOT allowed

Body

The data for the new discount

  • percentage number(double) | null

    Percentage of the discount for the room

  • discountedPrice number(double) | null

    Discounted price for the room

  • startDate string(date-time)

    Discount start date in UTC

  • endDate string(date-time)

    Discount end date in UTC

  • Additional properties are NOT allowed

Responses

  • Success

    Hide response attributes Show response attributes object
    • id string(uuid)
    • roomId string(uuid)
    • percentage number(double)
    • originalPrice number(double)
    • discountedPrice number(double)
    • startDate string(date-time)
    • endDate string(date-time)
    • Additional properties are NOT allowed
    Hide response attributes Show response attributes object
    • id string(uuid)
    • roomId string(uuid)
    • percentage number(double)
    • originalPrice number(double)
    • discountedPrice number(double)
    • startDate string(date-time)
    • endDate string(date-time)
    • Additional properties are NOT allowed
    Hide response attributes Show response attributes object
    • id string(uuid)
    • roomId string(uuid)
    • percentage number(double)
    • originalPrice number(double)
    • discountedPrice number(double)
    • startDate string(date-time)
    • endDate string(date-time)
    • Additional properties are NOT allowed
  • 201

    Returns the newly created discount

  • 400

    If the request data is invalid

  • 401

    User is not authenticated.

  • 403

    User is not authorized (not an admin).

POST /api/rooms/{roomId}/discounts
curl \
 -X POST http://api.example.com/api/rooms/{roomId}/discounts \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"percentage":42.0,"discountedPrice":42.0,"startDate":"2024-05-04T09:42:00+00:00","endDate":"2024-05-04T09:42:00+00:00"}'
curl \
 -X POST http://api.example.com/api/rooms/{roomId}/discounts \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: text/json"
curl \
 -X POST http://api.example.com/api/rooms/{roomId}/discounts \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/*+json"
Request example
{
  "percentage": 42.0,
  "discountedPrice": 42.0,
  "startDate": "2024-05-04T09:42:00+00:00",
  "endDate": "2024-05-04T09:42:00+00:00"
}
Request examples
{
  "percentage": 42.0,
  "discountedPrice": 42.0,
  "startDate": "2025-05-04T09:42:00Z",
  "endDate": "2025-05-04T09:42:00Z"
}
Request examples
{
  "percentage": 42.0,
  "discountedPrice": 42.0,
  "startDate": "2025-05-04T09:42:00Z",
  "endDate": "2025-05-04T09:42:00Z"
}
Response examples (200)
{
  "id": "string",
  "roomId": "string",
  "percentage": 42.0,
  "originalPrice": 42.0,
  "discountedPrice": 42.0,
  "startDate": "2024-05-04T09:42:00+00:00",
  "endDate": "2024-05-04T09:42:00+00:00"
}
Response examples (200)
{
  "id": "string",
  "roomId": "string",
  "percentage": 42.0,
  "originalPrice": 42.0,
  "discountedPrice": 42.0,
  "startDate": "2025-05-04T09:42:00Z",
  "endDate": "2025-05-04T09:42:00Z"
}