6. API version verification
Platforms are required to provide an HTTP header in each call to the Open Service Broker API, to indicate the version of the API specification that the platform supports. You can configure Spring Cloud Open Service Broker to verify the version provided by the platform on each call to the service broker. By default, this version verification is configured to allow any API version.
To customize the version verification, set the apiVersion
property that specifies the API version required by the service broker, as follows:
spring.cloud.openservicebroker.apiVersion=2.13
Alternatively, you can provide a BrokerApiVersion
Spring bean, as follows:
package com.example.servicebroker;
@Configuration
public class ExampleApiVersionConfiguration {
@Bean
public BrokerApiVersion brokerApiVersion() {
return new BrokerApiVersion("2.13");
}
}
In the case of both a Spring Bean and a property being configured, the Spring Bean takes precedence over the property.
If an API version is specified and the platform provides a different version in the X-Broker-API-Version
header, the framework returns a 412 Precondition Failed
error to the platform.
As mentioned earlier, the default version verification is configured to allow any API version.
However, to disable version verification entirely, you can set the api-version-check-endabled
property to false
, as follows:
spring.cloud.openservicebroker.api-version-check-enabled = false