Service Bindings API

Create a Service Binding

POST /v2/service_bindings

Request

Route

POST /v2/service_bindings?accepts_incomplete=true

Parameters

Name Description Valid Values Example Values
accepts_incomplete Set to `true` if the client allows asynchronous binding. The cloud controller may respond before the binding is ready for use.
  • true
  • false

Body

Name Description Default Valid Values Example Values
service_instance_guid The guid of the service instance to bind
app_guid The guid of the app to bind
binding_options A hash of options that are passed to v1 brokers
parameters Arbitrary parameters to pass along to the service broker. Must be a JSON object
name Binding name used to set the `VCAP_SERVICES.$SERVICE.name` environment variable. If `name` is not provided, `VCAP_SERVICES.$SERVICE.name` will default to the service instance name.
{
  "service_instance_guid": "a0029c76-7017-4a74-94b0-54a04ad94b80",
  "app_guid": "081d55a0-1bfa-4e51-8d08-273f764988db",
  "parameters": {
    "the_service_broker": "wants this object"
  },
  "name": "prod-db"
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQyOSIsImVtYWlsIjoiZW1haWwtMjkxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjYwMDg5MDN9.0nz1Ucxdt02DdJU5Hy01gCKXpkSXViUBT9mEveDB7WE
Host: example.org
Content-Type: application/json
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/service_bindings?accepts_incomplete=false" -d '{
  "service_instance_guid": "a0029c76-7017-4a74-94b0-54a04ad94b80",
  "app_guid": "081d55a0-1bfa-4e51-8d08-273f764988db",
  "parameters": {
    "the_service_broker": "wants this object"
  },
  "name": "prod-db"
}' -X POST \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQyOSIsImVtYWlsIjoiZW1haWwtMjkxQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NjYwMDg5MDN9.0nz1Ucxdt02DdJU5Hy01gCKXpkSXViUBT9mEveDB7WE" \
	-H "Host: example.org" \
	-H "Content-Type: application/json" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "4e690cd4-66ef-4052-a23d-0d748316f18c",
    "url": "/v2/service_bindings/4e690cd4-66ef-4052-a23d-0d748316f18c",
    "created_at": "2016-06-08T16:41:42Z",
    "updated_at": "2016-06-08T16:41:26Z"
  },
  "entity": {
    "app_guid": "081d55a0-1bfa-4e51-8d08-273f764988db",
    "service_instance_guid": "a0029c76-7017-4a74-94b0-54a04ad94b80",
    "credentials": {
      "creds-key-63": "creds-val-63"
    },
    "binding_options": {

    },
    "gateway_data": null,
    "gateway_name": "",
    "syslog_drain_url": null,
    "volume_mounts": [

    ],
    "name": "prod-db",
    "last_operation": {
      "type": "create",
      "state": "succeeded",
      "description": "",
      "updated_at": "2018-02-28T16:25:19Z",
      "created_at": "2018-02-28T16:25:19Z"
    },
    "app_url": "/v2/apps/081d55a0-1bfa-4e51-8d08-273f764988db",
    "service_instance_url": "/v2/user_provided_service_instances/a0029c76-7017-4a74-94b0-54a04ad94b80",
    "service_binding_parameters_url": "/v2/service_bindings/4e690cd4-66ef-4052-a23d-0d748316f18c/parameters"
  }
}

Headers

Content-Type: application/json;charset=utf-8
Location: /v2/service_bindings/4e690cd4-66ef-4052-a23d-0d748316f18c
X-VCAP-Request-ID: 57555efd-a472-4591-9b5d-63a2478292d0
Content-Length: 732
X-Content-Type-Options: nosniff