Skip to content

Turn public access on or off

Open a database on a public port, or close it.

Updated

patch

https://cloud.cahaves.com/api/services/{id}/database-public

Authorization

cahaves.cloud.sessionstringcookierequired

The session cookie Cloud sets when a customer signs in to the console with GitHub or Google. It is HttpOnly, so scripts cannot read it, and there are no API keys or tokens yet.

Path parameters

idstring<uuid>required

The service's id.

Example: "0b9e4d2a-7c13-4f6e-a8d5-3e1c9b7f2a40"

Headers

X-Cloud-Organizationstring<uuid>

The id of the organization the request works in, one the signed-in customer owns. Left out or empty, the request works in their oldest organization. Any other value answers 404 with `reason: "organization"`. A customer with no organization yet gets 409 "Create an organization first." from every route that works in one.

Example: "2f6c8e0a-4b1d-4e7f-9a3c-5d7e9f1b3a5c"

Body

application/jsonrequired

portinteger | null

Absent or null takes the lowest free port. A port another database on the node holds answers 422.

enabledbooleanrequired

Responses

application/json

The service detail with its public address.

serviceobjectrequired

The database restarts to apply either change. A request that matches the current state changes nothing. The answer's database.public carries the address to connect to.

StatusSentenceWhen
422A public port is a whole number from 20000 to 29999.port outside the range
422That port is taken on this node. Choose another.Another database on the node holds it
409Public access needs the platform's public address, which is not configured.The platform has no public address
409Every public port on this node is taken. Try again later.No port is free

Opening a paid database's public access is paid work: it answers 409 with a reason while the organization is not in good standing or is stopped for billing (Errors). Closing it never does.

The password is what protects a database with public access on; Databases covers choosing one.