FerryDocs
DevelopersAPI reference

environments

Environments (production, staging…): groups of services and datastores, each on a private network of its own. A service or datastore picks its environment when it is created and reaches only the datastores and services of that environment by name; outside production a web service answers at <service>.<environment>.<domain>. Only public URLs cross from one environment to another.

List environments

GET/api/v1/environments

Every environment, production first, with the names of its services and datastores and the DNS records its services need.

Authorization

AuthorizationBearer <token>

An API token: one created in the dashboard or by ferry login, or the server token stored in <data-dir>/api_token. GET requests may send it as ?access_token= instead.

In: header

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/environments" \  -H "Authorization: Bearer $FERRY_TOKEN"
[  {    "created_at": "2019-08-24T14:15:22Z",    "id": "string",    "name": "string",    "datastores": [      "string"    ],    "dns": [      {        "domain": "string",        "records": [          {            "name": "string",            "required": true,            "type": "string",            "value": "string"          }        ],        "wildcard": "string"      }    ],    "services": [      "string"    ],    "url_pattern": "string"  }]

Create an environment

POST/api/v1/environments

Creates the environment and its private network. Create services and datastores in it by naming it (environment) when creating them. Its web services answer at <service>.<environment>.<domain>: for each domain of the server that is not local, create the wildcard DNS record of dns (*.staging.example.com). Names follow the rules of service names and can't be changed.

Authorization

AuthorizationBearer <token>

An API token: one created in the dashboard or by ferry login, or the server token stored in <data-dir>/api_token. GET requests may send it as ?access_token= instead.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

POST /api/v1/environments

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/environments" \  -H "Authorization: Bearer $FERRY_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "created_at": "2019-08-24T14:15:22Z",  "id": "string",  "name": "string",  "datastores": [    "string"  ],  "dns": [    {      "domain": "string",      "records": [        {          "name": "string",          "required": true,          "type": "string",          "value": "string"        }      ],      "wildcard": "string"    }  ],  "services": [    "string"  ],  "url_pattern": "string"}

Get an environment

GET/api/v1/environments/{id}

Authorization

AuthorizationBearer <token>

An API token: one created in the dashboard or by ferry login, or the server token stored in <data-dir>/api_token. GET requests may send it as ?access_token= instead.

In: header

Path Parameters

id*string

Environment id or name.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/environments/string" \  -H "Authorization: Bearer $FERRY_TOKEN"
{  "created_at": "2019-08-24T14:15:22Z",  "id": "string",  "name": "string",  "datastores": [    "string"  ],  "dns": [    {      "domain": "string",      "records": [        {          "name": "string",          "required": true,          "type": "string",          "value": "string"        }      ],      "wildcard": "string"    }  ],  "services": [    "string"  ],  "url_pattern": "string"}

Delete an environment

DELETE/api/v1/environments/{id}

Removes an empty environment and its private network. Refused while it holds services or datastores (the message lists them: delete them first), and always for production.

Authorization

AuthorizationBearer <token>

An API token: one created in the dashboard or by ferry login, or the server token stored in <data-dir>/api_token. GET requests may send it as ?access_token= instead.

In: header

Path Parameters

id*string

Environment id or name.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/api/v1/environments/string" \  -H "Authorization: Bearer $FERRY_TOKEN"
Empty