API

Automation for the people.

API Basics

This API is what is considered "RESTful". The HTTPS endpoint that you will need to talk to is https://www.portfast.co.uk/api. There will be libraries for any language that you want to use which can facilitate communication with this API, you can even use curl from the command line if you are so inclined.

This documentation is very much incomplete, we will continue to work on it.


The API key is like a persistent session, so there is no need to log in. This is why it is important to keep it secret, and to set the access list only to your trusted addresses.

You can make the requests using any language, here is an example with curl. The responses are not pretty-printed so you might want to pipe it through python to make it more legible.

Node: /account/retrieve

Query:

$ curl https://www.portfast.co.uk/api/account/retrieve -s -H 'Content-Type: application/json' -H 'X-Portfast-Key: jfG3DExKHH0LpInh2AnY0LFyOTtl0r5IrISYIrhzMebB0ttt2d9jNmKku64ZuioXWql5A2yGw7njQeLJcXhrfqxtCxJPYz9MkhLsMtGs7bO2Gro9J9jMEI8tZS3LwFub' -d '{}' | python -m json.tool
{
    "address": {
        "address1": "7 Carter Knowle Road",
        "address2": "",
        "city": "Sheffield",
        "country": "GB",
        "county": "",
        "postcode": "S7 2DW"
    },
    "admin": true,
    "email": {
        "email": "tom@marmot.org.uk",
        "email2": "",
        "email2_offers": true,
        "email2_service": true,
        "email_googlemx": false,
        "email_offers": true,
        "email_service": true
    },
    "name": "Tom Bird",
    "organisation": "Portfast Ltd",
    "phone": {
        "fixed": "",
        "mobile": "+44.7968108197"
    },
    "suspended": false,
    "username": "tom",
    "uuid": "53d63966-1f4e-44e6-8639-30c00f720ba6"
}

Assuming you have permission, the system will respond with your user object.


API keys

You will need to generate an API key before you can use the API service. This is so that you aren't logging in with your usual username and password, and also for security it is IP address locked. You can generate it here.

Keep this key out of your version control system if you publish your code.


Services

These are your managed hosting products, for example DNS and web hosting.

Node: /service/list

This node lists your active services. You will receive an array of service objects. The most useful bit of data from this query is the UUID of the service, this allows you to manipulate it.

Response:

[
   {
      "product" : "DNS only",
      "expires" : "2015-10-25 01:41:42 +0100",
      "features" : {
         "www" : false,
         "dns" : true,
         "mysql" : false,
         "mail" : false
      },
      "quota" : {
         "domains_permitted" : 10,
         "domains_hosted" : 3
      },
      "active" : true,
      "epoch" : {
         "expires" : 1445733702
      },
      "uuid" : "67f65329-0dc3-4499-8522-86afc64df17d",
      "domains" : [
         "205.246.188.in-addr.arpa",
         "example.com",
         "example.net"
      ],
      "id" : 135,
      "configured" : true
   }
]

Node: /service/domain/add

Request:

{
	"domain" : "example.com",
	"service" : "67f65329-0dc3-4499-8522-86afc64df17d",
	"source" : "remote",
	"master" : "192.0.2.25"
}

Specifying no source results in the domain being created with a local master.

The response to this request is the complete service object, as above.


Node: /service/domain/delete

Request:

{
	"domain" : "example.com",
	"service" : "67f65329-0dc3-4499-8522-86afc64df17d"
}

The response to this request is empty.


All prices are exclusive of VAT.
Portfast Ltd :: Registered in England #6061075, 7 Carter Knowle Road, Sheffield, S7 2DW