# Method: inventory.partners.merchants.services.availability.replace

- [HTTP request](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.request_body)
  - [JSON representation](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.request_body.SCHEMA_REPRESENTATION)
    - [JSON representation](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.request_body.SCHEMA_REPRESENTATION.service_availability.SCHEMA_REPRESENTATION)
    - [JSON representation](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.request_body.SCHEMA_REPRESENTATION.service_availability.SCHEMA_REPRESENTATION_1)
- [Response body](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.response_body)
  - [JSON representation](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.ServiceAvailability.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability/replace#body.aspect)

Replaces the `https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Availability` of an existing `https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services#Service` of a merchant managed by the specified aggregator, and returns it.

### HTTP request

`POST https://mapsbooking.googleapis.com/v1alpha/inventory/{serviceAvailability.name=partners/*/merchants/*/services/*}/availability:replace`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `serviceAvailability.name` | `string` The resource name of the service to apply this to. In the format of `partners/{partner_id}/merchants/{merchantId}/services/{serviceId}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "serviceAvailability": { "name": string, "startTimeRestrict": string, "endTimeRestrict": string, "durationRestrict": string, "resourcesRestrict": { "staffId": string, "staffName": string, "roomId": string, "roomName": string, "partySize": integer, "roomDescription": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/Text`) } }, "availability": [ { "startTime": string, "duration": string, "spotsTotal": string, "spotsOpen": string, "availabilityTag": string, "resources": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Resources`) }, "paymentOptionId": [ string ], "recurrence": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Recurrence`) }, "scheduleException": [ { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#ScheduleException`) } ], "deposit": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/Deposit`) }, "noShowFee": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/NoShowFee`) }, "prepayment": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Prepayment`) }, "requireCreditCard": enum (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/RequireCreditCard`), "ticketTypeId": [ string ], "durationRequirement": enum (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#DurationRequirement`), "schedulingRuleOverrides": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#SchedulingRuleOverrides`) }, "confirmationMode": enum (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#ConfirmationMode`), "linkoutRequiredReason": enum (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#LinkoutRequiredReason`) } ] } } ``` |

| Fields ||
|---|---|
| `serviceAvailability.startTimeRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` If provided, we will consider the Availability entities provided to be a complete snapshot from \[startTimeRestrict, endTimeRestrict). That is, all existing availability will be deleted if the following condition holds true: startTimeRestrict <= availability.start_sec && availability.start_sec < endTimeRestrict If a duration message is set, the condition is further restricted: availability.duration == durationRestrict If a resourcesRestrict message is set, the condition is further restricted: availability.resources.staff_id == resourcesRestrict.staff_id && availability.resources.room_id == resourcesRestrict.room_id These fields are typically used to provide a complete update of availability in a given time range. Setting startTimeRestrict while leaving endTimeRestrict unset is interpreted to mean all time beginning at startTimeRestrict. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `serviceAvailability.endTimeRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Setting endTimeRestrict while leaving startTimeRestrict unset is interpreted to mean all time up to the endTimeRestrict. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `serviceAvailability.durationRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Setting duration further restricts the scope of the update to just the availability with matching duration. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `serviceAvailability.resourcesRestrict` | ``object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Resources`)`` Setting resourcesRestrict further restricts the scope of the update to just this set of resources. All id fields of the resources must match exactly. |
| `serviceAvailability.availability[]` | ``object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Availability`)`` The new list of availability. |

### Response body

A list of availability and who/when they should be applied to.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "name": string, "startTimeRestrict": string, "endTimeRestrict": string, "durationRestrict": string, "resourcesRestrict": { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Resources`) }, "availability": [ { object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Availability`) } ] } ``` |

| Fields ||
|---|---|
| `name` | `string` The resource name of the service to apply this to. In the format of `partners/{partner_id}/merchants/{merchantId}/services/{serviceId}` |
| `startTimeRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` If provided, we will consider the Availability entities provided to be a complete snapshot from \[startTimeRestrict, endTimeRestrict). That is, all existing availability will be deleted if the following condition holds true: startTimeRestrict <= availability.start_sec && availability.start_sec < endTimeRestrict If a duration message is set, the condition is further restricted: availability.duration == durationRestrict If a resourcesRestrict message is set, the condition is further restricted: availability.resources.staff_id == resourcesRestrict.staff_id && availability.resources.room_id == resourcesRestrict.room_id These fields are typically used to provide a complete update of availability in a given time range. Setting startTimeRestrict while leaving endTimeRestrict unset is interpreted to mean all time beginning at startTimeRestrict. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `endTimeRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Setting endTimeRestrict while leaving startTimeRestrict unset is interpreted to mean all time up to the endTimeRestrict. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `durationRestrict` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Setting duration further restricts the scope of the update to just the availability with matching duration. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `resourcesRestrict` | ``object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Resources`)`` Setting resourcesRestrict further restricts the scope of the update to just this set of resources. All id fields of the resources must match exactly. |
| `availability[]` | ``object (`https://developers.google.com/maps-booking/reference/maps-booking-api/rest/v1alpha/inventory.partners.merchants.services.availability#Availability`)`` The new list of availability. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/mapsbooking`