# Add or Update Booking Session Resource

<mark style="color:green;">`POST`</mark> `[PlatformAddress]/api/1.0/venue?action=addOrUpdateBookingSessionResource`

#### Request Body

| Name             | Type    | Description                                                                                                              |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
| venueId          | integer | The unique id of the venue to which the booking session resource belongs                                                 |
| bookingId        | integer | The unique id of the booking to which the session resource belongs                                                       |
| sessionId        | integer | The unique id of the booking session to which the resource belongs                                                       |
| resourceId       | integer | The unique id of the session resource to which the booking session resource belongs                                      |
| quantity         | integer | The quantity of the session resource (Required when the ID parameter is missing)                                         |
| startTime        | time    | The startTime of the session resource (Required when the ID parameter is missing)                                        |
| endTime          | time    | The endTime of the session resource (Required when the ID parameter is missing)                                          |
| includeInPackage | boolean | Whether or not the booking session resource is included in booking package (Required when the ID parameter is missing)   |
| bookingPackageId | integer | The booking package identifier if the booking session resource is included in package (Required when includeInPackage=1) |
| costCenterId     | integer | The cost center identifier to which the booking session resource's revenue applies (Required when includeInPackage=0)    |
| cost             | double  | The cost of the booking session resource (Required when includeInPackage=0)                                              |
| costType         | integer | The cost type of the booking session resource Cost Type (Required when includeInPackage=0)                               |
| excludedTaxIds   | array   | The excluded tax identifiers of the booking session resource (Only used when includeInPackage=0)                         |
| hasCommissions   | boolean | The booking session resource pay comissions to an agent                                                                  |
| id               | integer | The unique id of the booking session resource (Leave empty if adding a new booking session resource)                     |

{% tabs %}
{% tab title="200 " %}

```
{
  "success": true,
  "id": 7
}
```

{% endtab %}
{% endtabs %}

### Cost Type

One of the following values:

* 1 = Hourly
* 2 = Daily

#### Example Request

**Add booking session resource**

```javascript
{
    "venueId": 9,
    "bookingId": 29063,
    "sessionId": 19792,
    "resourceId": 27,
    "quantity": 10,
    "startTime": "5:00 AM",
    "endTime": "7:00 AM",
    "includeInPackage": 0,
    "bookingPackageId": 1,
    "cost": 25,
    "costType": 1,
    "costCenterId": 4
}
```

**Update booking session resource**

```javascript
{
  "id": 7,
  "venueId": 9,
  "bookingId": 29063,
  "sessionId": 19792,
  "startTime": "6:00 AM",
}
```

#### Returns

| Property | Description                                                   |
| -------- | ------------------------------------------------------------- |
| success  | Whether or not the booking session resource was added/updated |
| id       | The unique id of the booking session resource                 |

#### Throws

| Code                 | Description                                 |
| -------------------- | ------------------------------------------- |
| Specific Code: 24338 | The booking session does not exist          |
| Specific Code: 24339 | The booking session resource does not exist |
| Specific Code: 24340 | An unknown error has occurred               |
| Specific Code: 24341 | The request contains invalid data           |
| Specific Code: 24342 | The request contains invalid data           |
