NAV Navbar
shell
  • Introduction
  • Authentication
  • User
  • Token
  • VM
  • Container
  • Storage
  • Parameters
  • Billing
  • Payment
  • Pricing
  • Charging
  • Introduction

    Welcome to the PILW.IO API! You can use our API to create and manage compute and storage resources like Virtual Machines, Docker containers and Object Storage buckets.

    Authentication

    To authorize, use this code:

    # With shell, you can just pass the correct header with each request
    curl "api_endpoint_here"
      -H "apikey: meowmeowmeow"
    

    Make sure to replace meowmeowmeow with your API key.

    PILW.IO uses API tokens to allow access to the API. You can register a new API token at our user interface.

    PILW.IO expects for the API token to be included in all API requests to the server in a header that looks like the following:

    apikey: meowmeowmeow

    User

    Get User Info

    curl "https://api.pilw.io/v1/user-resource/user" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "cookie_id": "61b0378574974ae88dbfec0feb9917bc",
        "id": 8,
        "last_activity": "2018-02-22 14:18:47",
        "name": "sverik@oyenetwork.com",
        "profile": null,
        "profile_data": null,
        "state": {}
    }
    

    Authenticated user can request data-model for themselves

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/user

    Token

    Delete Token

    curl "https://api.pilw.io/v1/user-resource/token" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "token_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "Failed to delete kong token."
        }
    }
    

    Delete API token

    HTTP Request

    DELETE https://api.pilw.io/v1/user-resource/token

    Form Parameters

    Parameter Default Type
    token_id A Whole number

    Update Token

    curl "https://api.pilw.io/v1/user-resource/token" \
        -H "apikey: meowmeowmeow" \
        -X PATCH \
        -d "description=Description changed" \
        -d "restricted=false" \
        -d "token_id=3"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "Failed to update token."
        }
    }
    

    Update API token options.

    HTTP Request

    PATCH https://api.pilw.io/v1/user-resource/token

    Form Parameters

    Parameter Default Type
    billing_account_id 0 A Whole number
    description Basic text / string value
    restricted Providing any value will set this to true
    token_id A Whole number

    Create Token

    curl "https://api.pilw.io/v1/user-resource/token" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "description=Token Description" \
        -d "restricted=true" \
        -d "billing_account_id=6"
    

    The above command returns JSON structured like this:

    [
        {
            "billing_account_id": 0,
            "consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
            "created_at": "2018-02-21 14:00:07",
            "description": "hea token",
            "id": 2,
            "kong_id": "a7540e94-bc84-4f18-a391-002c9b31eb34",
            "restricted": false,
            "token": "vYNKd8VWHg583sTkAZ8vKbyVtyXWILXn",
            "updated_at": null,
            "user_id": 8
        },
        {
            "billing_account_id": 6,
            "consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
            "created_at": "2018-02-22 14:24:02",
            "description": "Token Description",
            "id": 7,
            "kong_id": "1dd6f9f7-f679-4ad0-a44d-9343c37a7dfb",
            "restricted": true,
            "token": "PS2vfOCKuU52be83QZhMMndqOusfFkHr",
            "updated_at": null,
            "user_id": 8
        }
    ]
    

    Create new token and register it at API Gateway

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/token

    Form Parameters

    Parameter Default Type
    billing_account_id 0 A Whole number
    description Basic text / string value
    restricted Accepts a true or false value

    List Tokens

    curl "https://api.pilw.io/v1/user-resource/token/list" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "billing_account_id": 0,
            "consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
            "created_at": "2018-02-21 14:00:07",
            "description": "hea token",
            "id": 2,
            "kong_id": "a7540e94-bc84-4f18-a391-002c9b31eb34",
            "restricted": false,
            "token": "vYNKd8VWHg583sTkAZ8vKbyVtyXWILXn",
            "updated_at": null,
            "user_id": 8
        },
        {
            "billing_account_id": 6,
            "consumer_id": "9b68f9e5-34a5-41bb-8938-944c17e38723",
            "created_at": "2018-02-22 14:24:02",
            "description": "Token Description",
            "id": 7,
            "kong_id": "1dd6f9f7-f679-4ad0-a44d-9343c37a7dfb",
            "restricted": true,
            "token": "PS2vfOCKuU52be83QZhMMndqOusfFkHr",
            "updated_at": null,
            "user_id": 8
        }
    ]
    

    List user API tokens

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/token/list

    VM

    Delete VM

    curl "https://api.pilw.io/v1/user-resource/vm" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "uuid=aaaaaaaa-0000-bbbb-1111-cccccccccccc"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "No such virtual machine exists. aaaaaaaa-0000-bbbb-1111-cccccccccccc"
        }
    }
    

    Delete virtual machine

    HTTP Request

    DELETE https://api.pilw.io/v1/user-resource/vm

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    Get VM Info

    curl "https://api.pilw.io/v1/user-resource/vm?uuid=f80b1d62-ffe4-43ef-9210-60f05445456a" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "backup": true,
        "billing_account": 6,
        "created_at": "2018-02-22 11:10:17",
        "description": "",
        "hostname": "hostname",
        "hypervisor_id": null,
        "id": 7,
        "mac": "52:54:00:6c:6a:ac",
        "memory": 2048,
        "name": "Ubuntu-16-04",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "",
        "public_ipv4": null,
        "status": "running",
        "storage": [
            {
                "created_at": "2018-02-22 11:10:37.793878",
                "id": 5,
                "name": "sda",
                "pool": "default2",
                "primary": true,
                "public_ipv4": null,
                "replica": [],
                "shared": false,
                "size": 20,
                "type": "block",
                "updated_at": null,
                "user_id": 8,
                "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a"
            }
        ],
        "tags": null,
        "updated_at": "2018-02-22 13:48:21",
        "user_id": 8,
        "username": "example",
        "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
        "vcpu": 2
    }
    

    Get virtual machine data

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/vm

    Query Parameters

    Parameter Default Type
    uuid Basic text / string value

    Change Password

    curl "https://api.pilw.io/v1/user-resource/vm/user" \
        -H "apikey: meowmeowmeow" \
        -X PATCH \
        -d "uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46" \
        -d "username=example" \
        -d "password=Password1234"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Set a new password for an existing user on the virtual machine. The VM must be running, otherwise the password cannot be changed and an error will be returned.

    HTTP Request

    PATCH https://api.pilw.io/v1/user-resource/vm/user

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier
    username Basic text / string value
    password Basic text / string value

    Modify VM

    curl "https://api.pilw.io/v1/user-resource/vm" \
        -H "apikey: meowmeowmeow" \
        -X PATCH \
        -d "uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46" \
        -d "name=web-server" \
        -d "vcpu=4" \
        -d "ram=2048"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Currently only name, vcpu and ram can be changed. Do note that vcpu and ram can only be changed when the machine is in stopped state.

    HTTP Request

    PATCH https://api.pilw.io/v1/user-resource/vm

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier
    name Basic text / string value
    ram A Whole number
    vcpu A Whole number

    Create VM

    curl "https://api.pilw.io/v1/user-resource/vm" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "name=Ubuntu-16-04" \
        -d "os_name=ubuntu" \
        -d "os_version=16.04" \
        -d "disks=20" \
        -d "vcpu=2" \
        -d "ram=2048" \
        -d "username=example" \
        -d "password=Password123" \
        -d "billing_account_id=6"
    

    The above command returns JSON structured like this:

    {
        "backup": false,
        "billing_account": 6,
        "created_at": "2018-02-22 14:24:03",
        "description": "",
        "hostname": "hostname",
        "hypervisor_id": null,
        "id": 10,
        "mac": "52:54:00:a2:52:6a",
        "memory": 2048,
        "name": "Ubuntu-16-04",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "",
        "public_ipv4": "80.64.107.50",
        "status": "running",
        "storage": [
            {
                "created_at": "2018-02-22 14:24:13.766985",
                "id": 8,
                "name": "sda",
                "pool": "default2",
                "primary": true,
                "public_ipv4": null,
                "replica": [],
                "shared": false,
                "size": 20,
                "type": "block",
                "updated_at": null,
                "user_id": 8,
                "uuid": "fc880f74-cf03-4a7a-93da-74c506157023"
            }
        ],
        "tags": null,
        "updated_at": "2018-02-22 14:24:13",
        "user_id": 8,
        "username": "example",
        "uuid": "fc880f74-cf03-4a7a-93da-74c506157023",
        "vcpu": 2
    }
    

    Create a new virtual machine. billing_account_id is optional if using an API token that is restricted to one billing account. Specify source_uuid and source_replica to create the new virtual machine as a copy of an existing backup or snapshot.

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm

    Form Parameters

    Parameter Default Type
    backup False Accepts a true or false value
    billing_account_id 0 A Whole number
    description Basic text / string value
    disks Basic text / string value
    name Basic text / string value
    os_name Basic text / string value
    os_version Basic text / string value
    password Basic text / string value
    public_key Basic text / string value
    ram A Whole number
    source_replica Basic text / string value
    source_uuid A Universally Unique IDentifier
    username Basic text / string value
    vcpu A Whole number

    Toggle Auto Backup

    curl "https://api.pilw.io/v1/user-resource/vm/backup" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=f80b1d62-ffe4-43ef-9210-60f05445456a"
    

    The above command returns JSON structured like this:

    {
        "backup": false,
        "billing_account": 6,
        "created_at": "2018-02-22 11:10:17",
        "description": "",
        "hostname": "hostname",
        "hypervisor_id": null,
        "id": 7,
        "mac": "52:54:00:6c:6a:ac",
        "memory": 2048,
        "name": "Ubuntu-16-04",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "",
        "public_ipv4": null,
        "status": "running",
        "storage": [
            {
                "created_at": "2018-02-22 11:10:37.793878",
                "id": 5,
                "name": "sda",
                "pool": "default2",
                "primary": true,
                "public_ipv4": null,
                "replica": [],
                "shared": false,
                "size": 20,
                "type": "block",
                "updated_at": null,
                "user_id": 8,
                "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a"
            }
        ],
        "tags": null,
        "updated_at": "2018-02-22 14:24:14",
        "user_id": 8,
        "username": "example",
        "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
        "vcpu": 2
    }
    

    Toggle automatic backups for virtual machine

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/backup

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    Clone VM

    curl "https://api.pilw.io/v1/user-resource/vm/clone" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=f80b1d62-ffe4-43ef-9210-60f05445456a" \
        -d "name=Name of the Clone"
    

    The above command returns JSON structured like this:

    {
        "backup": false,
        "billing_account": 6,
        "created_at": "2018-02-22 14:24:30",
        "description": "",
        "hostname": "hostname",
        "hypervisor_id": null,
        "id": 11,
        "mac": "52:54:00:59:44:d1",
        "memory": 2048,
        "name": "Name of the Clone",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "",
        "public_ipv4": "80.64.107.49",
        "status": "running",
        "storage": [
            {
                "created_at": "2018-02-22 14:24:30.312877",
                "id": 9,
                "name": "sda",
                "pool": "default2",
                "primary": true,
                "public_ipv4": null,
                "replica": [],
                "shared": false,
                "size": 20,
                "type": "block",
                "updated_at": null,
                "user_id": 8,
                "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43"
            }
        ],
        "tags": null,
        "updated_at": null,
        "user_id": 8,
        "username": "example",
        "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43",
        "vcpu": 2
    }
    

    Clone existing virtual machine

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/clone

    Form Parameters

    Parameter Default Type
    name Basic text / string value
    uuid A Universally Unique IDentifier

    Get IP addresses

    curl "https://api.pilw.io/v1/user-resource/vm/ip?uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "private_ipv4": "10.1.8.254",
        "public_ipv4": "176.112.151.206",
        "uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb46"
    }
    

    Get virtual machine's private and public IP addresses.

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/vm/ip

    Query Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    Release Public IP

    curl "https://api.pilw.io/v1/user-resource/vm/ip/public" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Release a virtual machine's public IP address. The address is not reserved, it may be assigned to some other virtual machine at a later time.

    HTTP Request

    DELETE https://api.pilw.io/v1/user-resource/vm/ip/public

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    Reserve Public IP

    curl "https://api.pilw.io/v1/user-resource/vm/ip/public" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46"
    

    The above command returns JSON structured like this:

    {
        "private_ipv4": "10.1.8.254",
        "public_ipv4": "176.112.151.206",
        "uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb46"
    }
    

    Reserve and assign a public IP address for a virtual machine.

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/ip/public

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    List VMs

    curl "https://api.pilw.io/v1/user-resource/vm/list" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 14:24:30",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 11,
            "mac": "52:54:00:59:44:d1",
            "memory": 2048,
            "name": "Name of the Clone",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.49",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 14:24:30.312877",
                    "id": 9,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43"
                }
            ],
            "tags": null,
            "updated_at": null,
            "user_id": 8,
            "username": "example",
            "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 14:24:03",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 10,
            "mac": "52:54:00:a2:52:6a",
            "memory": 2048,
            "name": "Ubuntu-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.50",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 14:24:13.766985",
                    "id": 8,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "fc880f74-cf03-4a7a-93da-74c506157023"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 14:24:13",
            "user_id": 8,
            "username": "example",
            "uuid": "fc880f74-cf03-4a7a-93da-74c506157023",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 11:29:30",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 8,
            "mac": "52:54:00:20:e4:ac",
            "memory": 2048,
            "name": "Ubuntu-3-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.52",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 11:29:41.098793",
                    "id": 6,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "dab38e6e-b5bf-41c5-9baa-be1f2ec47931"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 11:29:41",
            "user_id": 8,
            "username": "example",
            "uuid": "dab38e6e-b5bf-41c5-9baa-be1f2ec47931",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 11:10:17",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 7,
            "mac": "52:54:00:6c:6a:ac",
            "memory": 2048,
            "name": "Ubuntu-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": null,
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 11:10:37.793878",
                    "id": 5,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 14:24:14",
            "user_id": 8,
            "username": "example",
            "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 09:50:26",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 6,
            "mac": "52:54:00:d4:ba:a3",
            "memory": 2048,
            "name": "DEBUGXYZ-2-buntu",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.54",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 09:50:37.638670",
                    "id": 4,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "e624e5cb-e0f9-4b59-8686-0a4c829027c6"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 09:50:37",
            "user_id": 8,
            "username": "example",
            "uuid": "e624e5cb-e0f9-4b59-8686-0a4c829027c6",
            "vcpu": 2
        }
    ]
    

    Get virtual machine list

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/vm/list

    Rebuild from Replica

    curl "https://api.pilw.io/v1/user-resource/vm/rebuild" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb46" \
        -d "replica_uuid=5aea1842-895f-4bd3-8bd6-e37b2282fb462018-12-21-14-05-33"
    

    The above command returns JSON structured like this:

    {
        "backup": false,
        "billing_account": 129072,
        "created_at": "2018-12-18 13:30:59",
        "description": "6\u20ac",
        "hostname": "hostname",
        "hv_ip": "10.10.35.124",
        "hypervisor_id": null,
        "id": 1263,
        "mac": "52:54:00:45:e2:40",
        "memory": 2048,
        "name": "web-server",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "10.1.8.254",
        "public_ipv4": "176.112.151.206",
        "status": "stopped",
        "storage": [
            {
                "created_at": "2018-12-18 13:32:33.082406",
                "id": 1120,
                "name": "sda",
                "pool": "default2",
                "primary": true,
                "public_ipv4": null,
                "replica": [
                    {
                        "created_at": "2018-12-21 14:05:35.509898",
                        "id": 866,
                        "master_id": 1120,
                        "master_uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb46",
                        "pool": "",
                        "size": 20,
                        "type": "snapshot",
                        "updated_at": null,
                        "uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb462018-12-21-14-05-33"
                    }
                ],
                "shared": false,
                "size": 20,
                "type": "block",
                "updated_at": null,
                "user_id": 8,
                "uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb46"
            }
        ],
        "tags": null,
        "updated_at": "2018-12-21 14:19:14",
        "user_id": 8,
        "username": "sverik",
        "uuid": "5aea1842-895f-4bd3-8bd6-e37b2282fb46",
        "vcpu": 4
    }
    

    Discard virtual machine's current storage state and restore it from the specified replica.

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/rebuild

    Form Parameters

    Parameter Default Type
    replica_uuid Basic text / string value
    uuid A Universally Unique IDentifier

    Delete Replica

    curl "https://api.pilw.io/v1/user-resource/vm/replica" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "replica_uuid=val"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Delete replica by uuid

    HTTP Request

    DELETE https://api.pilw.io/v1/user-resource/vm/replica

    Form Parameters

    Parameter Default Type
    replica_uuid Basic text / string value

    List Replicas

    curl "https://api.pilw.io/v1/user-resource/vm/replica?uuid=f80b1d62-ffe4-43ef-9210-60f05445456a" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    []
    

    Get virtual machine storage replica list

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/vm/replica

    Query Parameters

    Parameter Default Type
    r_type snapshot Basic text / string value
    uuid A Universally Unique IDentifier

    Convert Replica

    curl "https://api.pilw.io/v1/user-resource/vm/replica" \
        -H "apikey: meowmeowmeow" \
        -X PATCH \
        -d "replica_uuid=aaaaaaaa-0000-bbbb-1111-cccccccccccc"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "No such storage replica exists."
        }
    }
    

    Convert replica from one type to another. Currently all snapshots and backups are same type so conversion is just changing type in database.

    HTTP Request

    PATCH https://api.pilw.io/v1/user-resource/vm/replica

    Form Parameters

    Parameter Default Type
    from_type backup Basic text / string value
    replica_uuid A Universally Unique IDentifier
    to_type snapshot Basic text / string value

    Create Replica

    curl "https://api.pilw.io/v1/user-resource/vm/replica" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=f80b1d62-ffe4-43ef-9210-60f05445456a"
    

    The above command returns JSON structured like this:

    {
        "created_at": "2018-02-22 11:10:37",
        "id": 5,
        "name": "sda",
        "pool": "default2",
        "primary": true,
        "public_ipv4": null,
        "replica": [
            {
                "created_at": "2018-02-22 14:24:51.886326",
                "id": 5,
                "master_id": 5,
                "master_uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
                "pool": "",
                "size": 60,
                "type": "snapshot",
                "updated_at": null,
                "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a2018-02-22-14-24-32"
            }
        ],
        "shared": false,
        "size": 20,
        "type": "block",
        "updated_at": null,
        "user_id": 8,
        "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a"
    }
    

    Create replica from block storage

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/replica

    Form Parameters

    Parameter Default Type
    r_type snapshot Basic text / string value
    uuid A Universally Unique IDentifier

    Start VM

    curl "https://api.pilw.io/v1/user-resource/vm/start" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=aaaaaaaa-0000-bbbb-1111-cccccccccccc"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "No such virtual machine exists. aaaaaaaa-0000-bbbb-1111-cccccccccccc"
        }
    }
    

    Start virtual machine

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/start

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier

    Stop VM

    curl "https://api.pilw.io/v1/user-resource/vm/stop" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=5052bf02-044a-4d35-a803-d6b156f84beb"
    

    The above command returns JSON structured like this:

    {
        "backup": false,
        "billing_account": 129072,
        "created_at": "2018-11-08 14:57:47",
        "description": "",
        "hostname": "hostname",
        "hv_ip": "10.10.35.125",
        "hypervisor_id": null,
        "id": 232,
        "mac": "52:54:00:18:db:d6",
        "memory": 4096,
        "name": "Ubuntu-16-04",
        "os_name": "ubuntu",
        "os_version": "16.04",
        "private_ipv4": "10.1.8.248",
        "status": "stopped",
        "storage": [
            {
                "created_at": "2018-11-08 14:58:19.237160",
                "public_ipv4": null,
                "primary": true,
                "type": "block",
                "name": "sda",
                "uuid": "5052bf02-044a-4d35-a803-d6b156f84beb",
                "updated_at": null,
                "shared": false,
                "pool": "default2",
                "size": 20,
                "user_id": 8,
                "id": 214,
                "replica": []
            }
        ],
        "tags": null,
        "updated_at": "2019-04-24 09:30:05",
        "user_id": 8,
        "username": "user",
        "uuid": "5052bf02-044a-4d35-a803-d6b156f84beb",
        "vcpu": 4
    }
    

    Stop a virtual machine. By default, tries to stop the VM gracefully via ACPI shutdown signal, this gives the OS the opportunity to do a proper shutdown. If, for some reason, the OS does not respond to a normal shutdown signal, an optional force=True parameter can be specified. This will "pull the plug" immediately, it is the physical equivalent of cutting the power supply to a machine. This has the potential danger of leaving behind corrupt data on the VM, so use it with caution.

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/stop

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier
    force False Accepts a true or false value

    Add Disk

    curl "https://api.pilw.io/v1/user-resource/vm/storage" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "uuid=5052bf02-044a-4d35-a803-d6b156f84beb" \
        -d "size_gb=50"
    

    The above command returns JSON structured like this:

    {
        "created_at": "2019-08-14 13:57:44",
        "name": "vdc",
        "pool": "default",
        "primary": false,
        "replica": [],
        "shared": false,
        "size": 50,
        "type": "block",
        "uuid": "3d91aa31-16ec-44ee-b8b3-22a0bda6559e"
    }
    

    Create and add a disk device of specified capacity to a virtual machine.

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/vm/storage

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier
    size_gb A Whole number

    Delete Disk

    curl "https://api.pilw.io/v1/user-resource/vm/storage" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "uuid=5052bf02-044a-4d35-a803-d6b156f84beb" \
        -d "storage_uuid=3d91aa31-16ec-44ee-b8b3-22a0bda6559e"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Disconnects and completely removes a disk device from a virtual machine. Data on that disk will be irrecoverably lost. Primary/boot disks cannot be deleted. Both VM UUID and disk UUID must be provided.

    HTTP Request

    DELETE https://api.pilw.io/v1/user-resource/vm/storage

    Form Parameters

    Parameter Default Type
    uuid A Universally Unique IDentifier
    storage_uuid A Universally Unique IDentifier

    Container

    Docker containers are spawned from services, and services always belong to some group. The group defines a namespace for the services. Also, billing account is configured on group level.

    Create Group

    curl "https://api.pilw.io/v1/container/groups/" \
        -H "apikey: meowmeowmeow" \
        -H "Content-Type: application/json" \
        -X POST \
        -d '{"name": "my-blog", "billing_account_id": 12345, "services": [{"name": "db", "image": "mariadb:10.1", "env": {"MYSQL_DATABASE": "wp", "MYSQL_PASSWORD": "wpass", "MYSQL_ROOT_PASSWORD": "wprootpass", "MYSQL_USER": "wpuser"}, "cpu": 0.2, "ram":256, "volumes": [{"container_path": "/var/lib/mysql"}]}, {"name": "web", "image": "wordpress:5.0.3-php7.2-apache", "env": {"WORDPRESS_DB_HOST": "db", "WORDPRESS_DB_NAME": "wp", "WORDPRESS_DB_PASSWORD": "wpass", "WORDPRESS_DB_USER": "wpuser"}, "cpu": 0.2, "ram": 128, "is_public": true, "service_port": 80, "http_exposed": false}]}'
    

    The above command returns JSON structured like this:

    {
        "billing_account_id": 12345,
        "created_at": "2019-02-27 09:22:08",
        "name": "my-blog",
        "services": [
            {
                "cpu": 0.2,
                "created_at": "2019-02-27 09:22:08",
                "env": {
                    "MYSQL_DATABASE": "wp",
                    "MYSQL_PASSWORD": "wpass",
                    "MYSQL_ROOT_PASSWORD": "wprootpass",
                    "MYSQL_USER": "wpuser"
                },
                "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                "http_exposed": false,
                "image": "mariadb:10.1",
                "instances": 1,
                "internal_host": "db.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                "is_public": false,
                "name": "db",
                "ram": 256,
                "suuid": "iz9gvduyt3rjxxtgo0lmk",
                "user_id": 35,
                "volumes": [
                    {
                        "container_path": "/var/lib/mysql",
                        "created_at": "2019-02-27 09:22:08"
                    }
                ]
            },
            {
                "cpu": 0.2,
                "created_at": "2019-02-27 09:22:08",
                "env": {
                    "WORDPRESS_DB_HOST": "db",
                    "WORDPRESS_DB_NAME": "wp",
                    "WORDPRESS_DB_PASSWORD": "wpass",
                    "WORDPRESS_DB_USER": "wpuser"
                },
                "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                "http_exposed": false,
                "image": "wordpress:5.0.3-php7.2-apache",
                "instances": 1,
                "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                "is_public": true,
                "name": "web",
                "public_host": "9b4x5udumrqqbxqnovrrrw1iynb.service.pilw.io",
                "ram": 128,
                "service_port": 80,
                "suuid": "ztwv4zefr9ykfythajomc5",
                "user_id": 35,
                "volume_access": "RW",
                "volumes": []
            }
        ],
        "suuid": "dfa2ifeuxf4uekmklsgxc5",
        "user_id": 35
    }
    

    Create a group of services.

    HTTP Request

    POST https://api.pilw.io/v1/container/groups/

    JSON attributes

    Attribute Type Description
    name String Unique name that is used also as a part of hostname.
    billing_account_id Integer optional All groups resources will be billed to this billing account. Required if using a global API token.
    services List optional A list of services to be created. See Create Service.

    Get Group

    curl "https://api.pilw.io/v1/container/groups/dfa2ifeuxf4uekmklsgxc5" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "created_at": "2019-02-27 09:22:08",
        "name": "my-blog",
        "services": [
            {
                "cpu": 0.2,
                "created_at": "2019-02-27 09:22:08",
                "env": {
                    "MYSQL_DATABASE": "wp",
                    "MYSQL_PASSWORD": "wpass",
                    "MYSQL_ROOT_PASSWORD": "wprootpass",
                    "MYSQL_USER": "wpuser"
                },
                "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                "http_exposed": false,
                "image": "mariadb:10.1",
                "instances": 1,
                "internal_host": "db.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                "is_public": false,
                "name": "db",
                "ram": 256,
                "status": "running",
                "status_changed_at": "2019-03-08 13:25:41",
                "suuid": "iz9gvduyt3rjxxtgo0lmk",
                "user_id": 35,
                "volumes": [
                    {
                        "container_path": "/var/lib/mysql",
                        "created_at": "2019-02-27 09:22:08"
                    }
                ]
            },
            {
                "cpu": 0.2,
                "created_at": "2019-02-27 09:22:08",
                "env": {
                    "WORDPRESS_DB_HOST": "db",
                    "WORDPRESS_DB_NAME": "wp",
                    "WORDPRESS_DB_PASSWORD": "wpass",
                    "WORDPRESS_DB_USER": "wpuser"
                },
                "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                "http_exposed": false,
                "image": "wordpress:5.0.3-php7.2-apache",
                "instances": 1,
                "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                "is_public": true,
                "name": "web",
                "ram": 128,
                "service_port": 80,
                "status": "running",
                "status_changed_at": "2019-03-08 13:25:41",
                "suuid": "ztwv4zefr9ykfythajomc5",
                "user_id": 35,
                "volumes": []
            }
        ],
        "suuid": "dfa2ifeuxf4uekmklsgxc5",
        "user_id": 35
    }
    

    Get a single group.

    HTTP Request

    GET https://api.pilw.io/v1/container/groups/{{group_suuid}}

    Path Parameters

    Parameter Type Description
    group_suuid String Group identifier, e.g. dfa2ifeuxf4uekmklsgxc5.

    List Groups

    curl "https://api.pilw.io/v1/container/groups/" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "created_at": "2019-02-27 09:22:08",
            "name": "my-blog",
            "services": [
                {
                    "cpu": 0.2,
                    "created_at": "2019-02-27 09:22:08",
                    "env": {
                        "MYSQL_DATABASE": "wp",
                        "MYSQL_PASSWORD": "wpass",
                        "MYSQL_ROOT_PASSWORD": "wprootpass",
                        "MYSQL_USER": "wpuser"
                    },
                    "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                    "http_exposed": false,
                    "image": "mariadb:10.1",
                    "instances": 1,
                    "internal_host": "db.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                    "is_public": false,
                    "name": "db",
                    "ram": 256,
                    "status": "running",
                    "status_changed_at": "2019-03-08 13:25:41",
                    "suuid": "iz9gvduyt3rjxxtgo0lmk",
                    "user_id": 35,
                    "volumes": [
                        {
                            "container_path": "/var/lib/mysql",
                            "created_at": "2019-02-27 09:22:08"
                        }
                    ]
                },
                {
                    "cpu": 0.2,
                    "created_at": "2019-02-27 09:22:08",
                    "env": {
                        "WORDPRESS_DB_HOST": "db",
                        "WORDPRESS_DB_NAME": "wp",
                        "WORDPRESS_DB_PASSWORD": "wpass",
                        "WORDPRESS_DB_USER": "wpuser"
                    },
                    "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
                    "http_exposed": false,
                    "image": "wordpress:5.0.3-php7.2-apache",
                    "instances": 1,
                    "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
                    "is_public": true,
                    "name": "web",
                    "ram": 128,
                    "service_port": 80,
                    "status": "running",
                    "status_changed_at": "2019-03-08 13:25:41",
                    "suuid": "ztwv4zefr9ykfythajomc5",
                    "user_id": 35,
                    "volumes": []
                }
            ],
            "suuid": "dfa2ifeuxf4uekmklsgxc5",
            "user_id": 35
        }
    ]
    

    Get a list of all groups.

    HTTP Request

    GET https://api.pilw.io/v1/container/groups/

    Modify Group

    curl "https://api.pilw.io/v1/container/groups/dfa2ifeuxf4uekmklsgxc5" \
        -H "apikey: meowmeowmeow" \
        -H "Content-Type: application/json" \
        -X PATCH \
        -d '{"billing_account_id": 129124,"services": [{"suuid": "iz9gvduyt3rjxxtgo0lmk","cpu": 0.3},{"suuid": "ztwv4zefr9ykfythajomc5","ram": 64}]}'
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Modify a group. Input is similar to Create Group. If a field is provided then the value is changed. Otherwise the value stays the same. So, if you only want to change the billing account then only provide billing_account_id in the request. If services list is not provided then services will not be changed. If services list is provided then all the services that are not represented in the list are deleted. It is enough to specify services' suuid, this will retain the services. Services can be modified by providing additional fields, see Modify Service for more information. Services can also be added by adding new elements to services list, just like when creating a group.

    HTTP Request

    PATCH https://api.pilw.io/v1/container/groups/{{group_suuid}}

    Path Parameters

    Parameter Type Description
    group_suuid String Group identifier, e.g. dfa2ifeuxf4uekmklsgxc5.

    JSON Attributes

    See Create Group. Trying to modify name will return an error.

    Delete Group

    curl "https://api.pilw.io/v1/container/groups/dfa2ifeuxf4uekmklsgxc5" \
        -H "apikey: meowmeowmeow" \
        -X DELETE
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Delete a group. This will delete all services that were in the group and all their persistent volumes.

    HTTP Request

    DELETE https://api.pilw.io/v1/container/groups/{{group_suuid}}

    Path Parameters

    Parameter Type Description
    group_suuid String Group identifier, e.g. dfa2ifeuxf4uekmklsgxc5.

    Create Service

    curl "https://api.pilw.io/v1/container/services/" \
        -H "apikey: meowmeowmeow" \
        -H "Content-Type: application/json" \
        -X POST \
        -d '{"name":"nginx","group_suuid":"dfa2ifeuxf4uekmklsgxc5","image":"nginx","cmd":"nginx -g 'daemon off;'","cpu":0.1,"ram":64,"is_public":true,"service_port":80,"http_exposed":true,"volumes":[{"container_path":"/usr/share/nginx/html/"},{"container_path":"/other-data/"}]}'
    

    The above command returns JSON structured like this:

    {
        "cmd": "nginx -g 'daemon off;'",
        "cpu": 0.1,
        "created_at": "2019-04-10 12:45:28",
        "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
        "http_exposed": true,
        "image": "nginx",
        "instances": 1,
        "internal_host": "nginx.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
        "is_public": true,
        "name": "nginx",
        "public_host": "3u2mxaiab0drpzr2vj1btuuepya.service.pilw.io",
        "ram": 64,
        "service_port": 80,
        "status": "running",
        "status_changed_at": "2019-04-10 12:45:28",
        "suuid": "7bh1dq4ct0wox5fhsbsko3",
        "user_id": 35,
        "volumes": [
            {
                "container_path": "/usr/share/nginx/html/",
                "created_at": "2019-04-10 12:45:28"
            },
            {
                "container_path": "/other-data/",
                "created_at": "2019-04-10 12:45:28"
            }
        ]
    }
    

    Create a service.

    HTTP Request

    POST https://api.pilw.io/v1/container/services/

    JSON attributes

    Attribute Type Description
    name String Name is used also as a hostname when accessing the service. Must be unique in group.
    image String Docker image full name, e.g. bitnami/wordpress:5-rhel-7.
    group_suuid String Required only if creating a single service to an already existing group.
    cmd String optional Command to be executed when running the container. Overrides the image's default command.
    cpu Number default: 0.01 Range: 0.01..4. Amount of CPU shares allocated to one spawned container instance.
    ram Integer default: 32 Range: 1..49152. Amount of RAM in MB allocated to one spawned container instance.
    instances Integer default: 1 Range: 0..10. Number of container instances to spawn from this service configuration.
    volumes List optional List of persistent volumes that are mounted to containers spawned from this service, see Volume attributes below. Volumes are automatically created with the service and deleted when the service is deleted. Volumes will survive underlying container removals and restarts.
    env Key-Value optional Key-value pairs of environment variables that are passed to containers spawned from this service.
    is_public Boolean default: false If true then this service's service_port will be accessible from the public Internet via HTTPS load balancer from the URL https://public_host:443/. SSL certificate for public_host will be aquired automatically.
    http_exposed Boolean default: false If true and is_public: true then service will be publicly accessible via HTTP port 80.
    service_port Integer optional If is_public: true then requests to public_host will be forwarded as plain HTTP requests to this service's service_port.
    public_host String optional Will be generated, if not specified and is_public: true.

    Volume attributes

    Attribute Type Description
    container_path String Path inside the container where the persistent volume is mounted.

    Get Service

    curl "https://api.pilw.io/v1/container/services/iz9gvduyt3rjxxtgo0lmk" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "cpu": 0.2,
        "created_at": "2019-02-27 09:22:08",
        "env": {
            "MYSQL_DATABASE": "wp",
            "MYSQL_PASSWORD": "wpass",
            "MYSQL_ROOT_PASSWORD": "wprootpass",
            "MYSQL_USER": "wpuser"
        },
        "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
        "http_exposed": false,
        "image": "mariadb:10.1",
        "instances": 1,
        "internal_host": "db.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
        "is_public": false,
        "name": "db",
        "ram": 256,
        "status": "running",
        "status_changed_at": "2019-03-08 13:25:41",
        "suuid": "iz9gvduyt3rjxxtgo0lmk",
        "user_id": 35,
        "volumes": [
            {
                "container_path": "/var/lib/mysql",
                "created_at": "2019-02-27 09:22:08"
            }
        ]
    }
    

    Get a single service.

    HTTP Request

    GET https://api.pilw.io/v1/container/services/{{service_suuid}}

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. iz9gvduyt3rjxxtgo0lmk.

    Modify Service

    curl "https://api.pilw.io/v1/container/services/ztwv4zefr9ykfythajomc5" \
        -H "apikey: meowmeowmeow" \
        -H "Content-Type: application/json" \
        -X PATCH \
        -d '{"instances": 2, "ram": 80}'
    

    The above command returns JSON structured like this:

    {
        "cpu": 0.2,
        "created_at": "2019-02-27 09:22:08",
        "env": {
            "WORDPRESS_DB_HOST": "db",
            "WORDPRESS_DB_NAME": "wp",
            "WORDPRESS_DB_PASSWORD": "wpass",
            "WORDPRESS_DB_USER": "wpuser"
        },
        "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
        "http_exposed": false,
        "image": "wordpress:5.0.3-php7.2-apache",
        "instances": 2,
        "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
        "is_public": true,
        "name": "web",
        "public_host": "9b4x5udumrqqbxqnovrrrw1iynb.service.pilw.io",
        "ram": 80,
        "service_port": 80,
        "status": "running",
        "status_changed_at": "2019-04-11 08:01:48",
        "suuid": "ztwv4zefr9ykfythajomc5",
        "updated_at": "2019-04-11 09:12:01",
        "user_id": 35,
        "volumes": []
    }
    

    Modify a service. Immediately after this PATCH call, new containers are spawned with the new configuration. If this is successful then old containers are destroyed. Input is similar to Create Service. If a field is provided then the value is changed. Otherwise the value stays the same. So, if you only want to change the instance count then only provide instances in the request. If env is provided then the whole set of environment variables will be replaced with the new value of env. Variables that are not specified will be removed.

    HTTP Request

    PATCH https://api.pilw.io/v1/container/services/{{service_suuid}}

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. ztwv4zefr9ykfythajomc5.

    JSON Attributes

    See Create Service. Trying to modify name will return an error.

    Delete Service

    curl "https://api.pilw.io/v1/container/services/iz9gvduyt3rjxxtgo0lmk" \
        -H "apikey: meowmeowmeow" \
        -X DELETE
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Delete a service.

    HTTP Request

    DELETE https://api.pilw.io/v1/container/services/{{service_suuid}}

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. iz9gvduyt3rjxxtgo0lmk.

    Start Service

    curl "https://api.pilw.io/v1/container/services/ztwv4zefr9ykfythajomc5/start" \
        -H "apikey: meowmeowmeow" \
        -X PUT
    

    The above command returns JSON structured like this:

    {
        "cpu": 0.2,
        "created_at": "2019-02-27 09:22:08",
        "env": {
            "WORDPRESS_DB_HOST": "db",
            "WORDPRESS_DB_NAME": "wp",
            "WORDPRESS_DB_PASSWORD": "wpass",
            "WORDPRESS_DB_USER": "wpuser"
        },
        "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
        "http_exposed": false,
        "image": "wordpress:5.0.3-php7.2-apache",
        "instances": 1,
        "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
        "is_public": true,
        "name": "web",
        "ram": 128,
        "service_port": 80,
        "status": "running",
        "status_changed_at": "2019-04-11 08:01:48",
        "suuid": "ztwv4zefr9ykfythajomc5",
        "updated_at": "2019-04-11 08:01:48",
        "user_id": 35,
        "volumes": []
    }
    

    Spawns and starts containers from the service configuration. instances defines how many containers will be spawned.

    HTTP Request

    PUT https://api.pilw.io/v1/container/services/{{service_suuid}}/start

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. ztwv4zefr9ykfythajomc5.

    Stop Service

    curl "https://api.pilw.io/v1/container/services/ztwv4zefr9ykfythajomc5/stop" \
        -H "apikey: meowmeowmeow" \
        -X PUT
    

    The above command returns JSON structured like this:

    {
        "cpu": 0.2,
        "created_at": "2019-02-27 09:22:08",
        "env": {
            "WORDPRESS_DB_HOST": "db",
            "WORDPRESS_DB_NAME": "wp",
            "WORDPRESS_DB_PASSWORD": "wpass",
            "WORDPRESS_DB_USER": "wpuser"
        },
        "group_suuid": "dfa2ifeuxf4uekmklsgxc5",
        "http_exposed": false,
        "image": "wordpress:5.0.3-php7.2-apache",
        "instances": 1,
        "internal_host": "web.my-blog.psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv.service.consul",
        "is_public": true,
        "name": "web",
        "ram": 128,
        "service_port": 80,
        "status": "stopped",
        "status_changed_at": "2019-04-11 08:00:51",
        "suuid": "ztwv4zefr9ykfythajomc5",
        "updated_at": "2019-04-11 08:00:51",
        "user_id": 35,
        "volumes": []
    }
    

    Shuts down and removes all containers that have been spawn from the service configuration. Stopped services are not billed.

    HTTP Request

    PUT https://api.pilw.io/v1/container/services/{{service_suuid}}/stop

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. ztwv4zefr9ykfythajomc5.

    Get Logs

    curl "https://api.pilw.io/v1/container/services/ztwv4zefr9ykfythajomc5/logs" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "state": "TASK_RUNNING",
            "timestamp": 1554969710.49381,
            "stdout": "",
            "stderr": "I0411 11:01:48.383363 25732 exec.cpp:162] Version: 1.4.1\nI0411 11:01:48.386483 25750 exec.cpp:237] Executor registered on agent 684f6ea0-d19f-4a86-b1db-a2713e929deb-S0\nI0411 11:01:48.386806 25752 executor.cpp:120] Registered docker executor on test-hv-4\nI0411 11:01:48.387470 25753 executor.cpp:160] Starting task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.0e616435-5c30-11e9-beb9-c6d58a33380d\nWordPress not found in /var/www/html - copying now...\nComplete! WordPress has been successfully copied to /var/www/html\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.185. Set the 'ServerName' directive globally to suppress this message\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.185. Set the 'ServerName' directive globally to suppress this message\n[Thu Apr 11 08:01:51.455755 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.15 configured -- resuming normal operations\n[Thu Apr 11 08:01:51.455811 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'\n"
        },
        {
            "state": "TASK_RUNNING",
            "timestamp": 1552463792.35631,
            "stdout": "\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n10.10.34.12 - - [27/Mar/2019:08:39:25 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:29 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:36 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:37 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:43 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:10 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:15 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:11 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:16 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:23 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4262 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:08:35:44 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)\"\n10.10.34.12 - - [04/Apr/2019:14:24:28 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:14:24:30 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4327 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n",
            "stderr": "I0313 09:56:22.318536  3700 exec.cpp:162] Version: 1.4.1\nI0313 09:56:22.320222  3749 exec.cpp:237] Executor registered on agent 684f6ea0-d19f-4a86-b1db-a2713e929deb-S0\nI0313 09:56:22.320570  3752 executor.cpp:120] Registered docker executor on test-hv-4\nI0313 09:56:22.320662  3753 executor.cpp:160] Starting task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\nWordPress not found in /var/www/html - copying now...\nComplete! WordPress has been successfully copied to /var/www/html\n\nMySQL Connection Error: (2002) Connection timed out\n\nMySQL Connection Error: (2002) Connection timed out\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\n[Wed Mar 13 07:58:39.249697 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.15 configured -- resuming normal operations\n[Wed Mar 13 07:58:39.249747 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'\nI0411 11:00:51.168340  3737 executor.cpp:269] Received killTask for task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\n[Thu Apr 11 08:00:51.244886 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down\nI0411 11:00:53.177348  3754 process.cpp:1068] Failed to accept socket: future discarded\n"
        },
        {
            "state": "TASK_KILLING",
            "timestamp": 1554969651.1766,
            "stdout": "\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n10.10.34.12 - - [27/Mar/2019:08:39:25 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:29 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:36 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:37 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:43 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:10 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:15 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:11 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:16 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:23 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4262 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:08:35:44 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)\"\n10.10.34.12 - - [04/Apr/2019:14:24:28 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:14:24:30 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4327 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n",
            "stderr": "I0313 09:56:22.318536  3700 exec.cpp:162] Version: 1.4.1\nI0313 09:56:22.320222  3749 exec.cpp:237] Executor registered on agent 684f6ea0-d19f-4a86-b1db-a2713e929deb-S0\nI0313 09:56:22.320570  3752 executor.cpp:120] Registered docker executor on test-hv-4\nI0313 09:56:22.320662  3753 executor.cpp:160] Starting task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\nWordPress not found in /var/www/html - copying now...\nComplete! WordPress has been successfully copied to /var/www/html\n\nMySQL Connection Error: (2002) Connection timed out\n\nMySQL Connection Error: (2002) Connection timed out\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\n[Wed Mar 13 07:58:39.249697 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.15 configured -- resuming normal operations\n[Wed Mar 13 07:58:39.249747 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'\nI0411 11:00:51.168340  3737 executor.cpp:269] Received killTask for task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\n[Thu Apr 11 08:00:51.244886 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down\nI0411 11:00:53.177348  3754 process.cpp:1068] Failed to accept socket: future discarded\n"
        },
        {
            "state": "TASK_FINISHED",
            "timestamp": 1554969652.17684,
            "stdout": "\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n\nWarning: mysqli::__construct(): (HY000/2002): Connection timed out in Standard input code on line 22\n10.10.34.12 - - [27/Mar/2019:08:39:25 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:26 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:29 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:36 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:37 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:38 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:43 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:39:49 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:10 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:08:40:15 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:11 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:16 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:12:23 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [27/Mar/2019:09:17:52 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4262 \"-\" \"Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:08:35:44 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)\"\n10.10.34.12 - - [04/Apr/2019:14:24:28 +0000] \"GET / HTTP/1.1\" 302 358 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n10.10.34.12 - - [04/Apr/2019:14:24:30 +0000] \"GET /wp-admin/install.php HTTP/1.1\" 200 4327 \"-\" \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36\"\n",
            "stderr": "I0313 09:56:22.318536  3700 exec.cpp:162] Version: 1.4.1\nI0313 09:56:22.320222  3749 exec.cpp:237] Executor registered on agent 684f6ea0-d19f-4a86-b1db-a2713e929deb-S0\nI0313 09:56:22.320570  3752 executor.cpp:120] Registered docker executor on test-hv-4\nI0313 09:56:22.320662  3753 executor.cpp:160] Starting task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\nWordPress not found in /var/www/html - copying now...\nComplete! WordPress has been successfully copied to /var/www/html\n\nMySQL Connection Error: (2002) Connection timed out\n\nMySQL Connection Error: (2002) Connection timed out\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.35.141. Set the 'ServerName' directive globally to suppress this message\n[Wed Mar 13 07:58:39.249697 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.15 configured -- resuming normal operations\n[Wed Mar 13 07:58:39.249747 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'\nI0411 11:00:51.168340  3737 executor.cpp:269] Received killTask for task psizkzbxl0ylfrtmxb8algreav8e1wk6bdwfc90zsgv_dfa2ifeuxf4uekmklsgxc5_ztwv4zefr9ykfythajomc5.7db5f146-4565-11e9-8fb8-3cfdfe9ed008\n[Thu Apr 11 08:00:51.244886 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down\nI0411 11:00:53.177348  3754 process.cpp:1068] Failed to accept socket: future discarded\n"
        }
    ]
    

    Get all logs, everything that the service containers have written to standard out and standar error streams. In the response there is an element for each container that has ever existed for the service.

    HTTP Request

    GET https://api.pilw.io/v1/container/services/{{service_suuid}}/logs/

    Path Parameters

    Parameter Type Description
    service_suuid String Service identifier, e.g. ztwv4zefr9ykfythajomc5.

    Query Parameters

    Parameter Type Description
    state_filter String optional Get logs only from containers of this specific state, e.g. TASK_FAILED.

    Configure Registry

    curl "https://api.pilw.io/v1/container/registries/my-private-registry.example.com" \
        -H "apikey: meowmeowmeow" \
        -X PUT \
        -d "username=pilw" \
        -d "password=SecurePassword1234"
    

    The above command returns JSON structured like this:

    {
        "created_at": "2019-03-12 13:34:40",
        "hostname": "my-private-registry.example.com",
        "username": "pilw"
    }
    

    Provides access for the platform to a Docker registry that requires login. When running an image that comes from a registry that requires authentication, these username and password will be used for docker login {{registry}}. The same request can be used both for initial setup and for updating the password.

    HTTP Request

    PUT https://api.pilw.io/v1/container/registries/{{hostname}}

    Path Parameters

    Parameter Type Description
    hostname String Hostname of the private registry.

    Query Parameters

    Parameter Type Description
    username String Username for docker login.
    password String Password for docker login, will be stored in encrypted form.

    List Registries

    curl "https://api.pilw.io/v1/container/registries/" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "created_at": "2019-03-12 13:34:40",
            "hostname": "my-company-images.company.io",
            "username": "pilw-ro"
        },
        {
            "created_at": "2019-04-11 09:41:50",
            "hostname": "my-private-registry.example.com",
            "username": "pilw"
        }
    ]
    

    Lists all configured Docker registries.

    HTTP Request

    GET https://api.pilw.io/v1/container/registries/

    Delete Registry

    curl "https://api.pilw.io/v1/container/registries/my-private-registry.example.com" \
        -H "apikey: meowmeowmeow" \
        -X DELETE
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Deletes credentials to the specified registry. Images from this registry will not be accessible to the platform anymore. Already running containers will not be affected.

    HTTP Request

    DELETE https://api.pilw.io/v1/container/registries/{{hostname}}

    Path Parameters

    Parameter Type Description
    hostname String Hostname of the private registry.

    Storage

    S3 API Info

    curl "https://api.pilw.io/v1/storage/api/s3" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "url": "https://s3.pilw.io:8080/"
    }
    

    Returns S3 API URL.

    HTTP Request

    GET https://api.pilw.io/v1/storage/api/s3

    Create Bucket

    curl "https://api.pilw.io/v1/storage/bucket" \
        -H "apikey: meowmeowmeow" \
        -X PUT \
        -d "name=pang1" \
        -d "billing_account_id=129093"
    

    The above command returns JSON structured like this:

    {
        "name": "pang1",
        "size_bytes": 0,
        "billing_account_id": 129093,
        "num_objects": 0
    }
    

    Create an S3 object storage bucket. Bucket names must be globally unique across all users.

    HTTP Request

    PUT https://api.pilw.io/v1/storage/bucket

    Form Parameters

    Parameter Type Description
    name String Bucket name, must conform to S3 bucket naming rules.
    billing_account_id Integer optional Required if using a global API token.

    Modify Bucket

    curl "https://api.pilw.io/v1/storage/bucket" \
        -H "apikey: meowmeowmeow" \
        -X PATCH \
        -d "name=pang1" \
        -d "billing_account_id=129072"
    

    The above command returns JSON structured like this:

    {
        "name": "pang1",
        "size_bytes": 3425,
        "billing_account_id": 129072,
        "num_objects": 1
    }
    

    Modify a bucket's billing account.

    HTTP Request

    PATCH https://api.pilw.io/v1/storage/bucket

    Form Parameters

    Parameter Type Description
    name String Defines which bucket to modify.
    billing_account_id Integer ID of a billing account.

    Delete Bucket

    curl "https://api.pilw.io/v1/storage/bucket?name=pang1" \
        -H "apikey: meowmeowmeow" \
        -X DELETE
    

    The above command returns HTTP status 204 No Content

    Delete an S3 object storage bucket. Only empty buckets can be deleted via this API.

    HTTP Request

    DELETE https://api.pilw.io/v1/storage/bucket

    Query Parameters

    Parameter Type Description
    name String Defines which bucket to delete.

    Get Bucket

    curl "https://api.pilw.io/v1/storage/bucket?name=pang1" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "billing_account_id": 129093,
        "name": "pang1",
        "num_objects": 5,
        "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.4797.2",
        "size_bytes": 3189211059
    }
    

    Get bucket information.

    HTTP Request

    GET https://api.pilw.io/v1/storage/bucket

    Query Parameters

    Parameter Type Description
    name String Defines which bucket to retrieve.

    List Buckets

    curl "https://api.pilw.io/v1/storage/bucket/list?billing_account_id=7" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "billing_account_id": 7,
            "name": "asi",
            "num_objects": 0,
            "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.34687.4",
            "size_bytes": 0
        },
        {
            "billing_account_id": 129093,
            "name": "pang1",
            "num_objects": 5,
            "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.4797.2",
            "size_bytes": 3189211059
        },
        {
            "billing_account_id": 7,
            "name": "pang2",
            "num_objects": 1,
            "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.24922.5",
            "size_bytes": 1587609600
        },
        {
            "billing_account_id": 7,
            "name": "pang3",
            "num_objects": 0,
            "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.4797.5",
            "size_bytes": 0
        },
        {
            "billing_account_id": 7,
            "name": "porgandid",
            "num_objects": 0,
            "s3_id": "9557ab21-cc5a-4e39-8694-547594b05790.4809.8",
            "size_bytes": 0
        }
    ]
    

    List user's buckets. Optionally filter the list by billing account.

    HTTP Request

    GET https://api.pilw.io/v1/storage/bucket/list

    Query Parameters

    Parameter Type Description
    billing_account_id Integer optional If specified then only buckets with this billing account are returned.

    Get S3 user

    curl "https://api.pilw.io/v1/storage/user" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "caps": [],
        "displayName": "sverik+test@oyenetwork.com",
        "email": "",
        "maxBuckets": 1000,
        "s3Credentials": [
            {
                "accessKey": "ES1R...1N",
                "secretKey": "bwtl...LU",
                "userId": "sverik+test@oyenetwork.com"
            },
            {
                "accessKey": "H2MZ...0A",
                "secretKey": "X8Pb...1j",
                "userId": "sverik+test@oyenetwork.com"
            },
            {
                "accessKey": "I16N...0T",
                "secretKey": "bdwq...cn",
                "userId": "sverik+test@oyenetwork.com"
            },
            {
                "accessKey": "V5G9...6P",
                "secretKey": "WnNy...C5",
                "userId": "sverik+test@oyenetwork.com"
            }
        ],
        "subusers": [],
        "suspended": 0,
        "swiftCredentials": [],
        "userId": "sverik+test@oyenetwork.com"
    }
    

    Get S3 user info, including their access and secret keys. User and keys will be generated, if they do not exist already.

    HTTP Request

    GET https://api.pilw.io/v1/storage/user

    Delete key

    curl "https://api.pilw.io/v1/storage/user/keys" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "access_key=I16N8YDF6A6FX8ILP30T"
    

    The above command returns JSON structured like this:

    
    

    Delete an S3 key.

    HTTP Request

    DELETE https://api.pilw.io/v1/storage/user/keys

    Form Parameters

    Parameter Type Description
    access_key String Defines which key to delete.

    Get keys

    curl "https://api.pilw.io/v1/storage/user/keys" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "accessKey": "ES1R...1N",
            "secretKey": "bwtl...LU",
            "userId": "sverik+test@oyenetwork.com"
        },
        {
            "accessKey": "H2MZ...0A",
            "secretKey": "X8Pb...1j",
            "userId": "sverik+test@oyenetwork.com"
        },
        {
            "accessKey": "V5G9...6P",
            "secretKey": "WnNy...C5",
            "userId": "sverik+test@oyenetwork.com"
        }
    ]
    

    Returns all user keys.

    HTTP Request

    GET https://api.pilw.io/v1/storage/user/keys

    Generate key

    curl "https://api.pilw.io/v1/storage/user/keys" \
        -H "apikey: meowmeowmeow" \
        -X POST
    

    The above command returns JSON structured like this:

    [
        {
            "accessKey": "44PW...BC",
            "secretKey": "etxH...O1",
            "userId": "sverik+test@oyenetwork.com"
        },
        {
            "accessKey": "ES1R...1N",
            "secretKey": "bwtl...LU",
            "userId": "sverik+test@oyenetwork.com"
        },
        {
            "accessKey": "H2MZ...0A",
            "secretKey": "X8Pb...1j",
            "userId": "sverik+test@oyenetwork.com"
        },
        {
            "accessKey": "V5G9...6P",
            "secretKey": "WnNy...C5",
            "userId": "sverik+test@oyenetwork.com"
        }
    ]
    

    Generate a new S3 key pair. Returns the list of all keys.

    HTTP Request

    POST https://api.pilw.io/v1/storage/user/keys

    Parameters

    VM parameters

    curl "https://api.pilw.io/v1/api/parameters/vm" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "constraint": "range",
            "description": "Size of main storage in gigabytes.",
            "mandatory": true,
            "max": 240,
            "min": 20,
            "parameter": "disks",
            "type": "integer"
        },
        {
            "constraint": "regexp",
            "description": "Name of the VM",
            "expression": "^[0-9a-zA-Z][-0-9a-zA-Z]{2,}[0-9a-zA-Z]$",
            "mandatory": true,
            "parameter": "name",
            "type": "string"
        },
        {
            "constraint": "enum",
            "description": "OS name of VM base image.",
            "mandatory": true,
            "parameter": "os_name",
            "type": "string",
            "values": [
                "centos",
                "ubuntu",
                "windows",
                "debian"
            ]
        },
        {
            "constraint": "enum",
            "description": "OS version of VM base image.",
            "limited_by": "os_name",
            "limits": [
                {
                    "os_name": "centos",
                    "values": [
                        "7.3.1611",
                        "6.9.1611"
                    ]
                },
                {
                    "os_name": "ubuntu",
                    "values": [
                        "16.04"
                    ]
                },
                {
                    "os_name": "windows",
                    "values": [
                        "2016"
                    ]
                },
                {
                    "os_name": "debian",
                    "values": [
                        "9.1"
                    ]
                }
            ],
            "mandatory": true,
            "parameter": "os_version",
            "type": "string"
        },
        {
            "constraint": "regexp",
            "description": "Password for logging in to the VM.",
            "expression": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",
            "mandatory": true,
            "parameter": "password",
            "type": "string"
        },
        {
            "constraint": "range",
            "description": "Amount of RAM.",
            "limited_by": "os_name",
            "limits": [
                {
                    "min": 1024,
                    "os_name": "windows"
                }
            ],
            "mandatory": true,
            "max": 65536,
            "min": 512,
            "parameter": "ram",
            "type": "integer"
        },
        {
            "constraint": "regexp",
            "description": "Username for logging in to the VM.",
            "expression": "^(?=.{1,30}$)[a-zA-Z_][0-9a-zA-Z_-]*$",
            "limited_by": "os_name",
            "limits": [
                {
                    "mandatory": false,
                    "os_name": "windows"
                }
            ],
            "mandatory": true,
            "parameter": "username",
            "type": "string"
        },
        {
            "constraint": "range",
            "description": "Number of CPUs.",
            "limited_by": "os_name",
            "limits": [
                {
                    "min": 2,
                    "os_name": "windows"
                }
            ],
            "mandatory": true,
            "max": 16,
            "min": 1,
            "parameter": "vcpu",
            "type": "integer"
        }
    ]
    

    Describes VM creation parameters and their expected and allowed values.

    HTTP Request

    GET https://api.pilw.io/v1/api/parameters/vm

    Billing

    List Billing Account's Resources

    curl "https://api.pilw.io/v1/user-resource/billing_resources?id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 09:50:26",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 6,
            "mac": "52:54:00:d4:ba:a3",
            "memory": 2048,
            "name": "DEBUGXYZ-2-buntu",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.54",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 09:50:37.638670",
                    "id": 4,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "e624e5cb-e0f9-4b59-8686-0a4c829027c6"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 09:50:37",
            "user_id": 8,
            "username": "example",
            "uuid": "e624e5cb-e0f9-4b59-8686-0a4c829027c6",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 11:29:30",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 8,
            "mac": "52:54:00:20:e4:ac",
            "memory": 2048,
            "name": "Ubuntu-3-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.52",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 11:29:41.098793",
                    "id": 6,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "dab38e6e-b5bf-41c5-9baa-be1f2ec47931"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 11:29:41",
            "user_id": 8,
            "username": "example",
            "uuid": "dab38e6e-b5bf-41c5-9baa-be1f2ec47931",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 14:24:03",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 10,
            "mac": "52:54:00:a2:52:6a",
            "memory": 2048,
            "name": "Ubuntu-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.50",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 14:24:13.766985",
                    "id": 8,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "fc880f74-cf03-4a7a-93da-74c506157023"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 14:24:13",
            "user_id": 8,
            "username": "example",
            "uuid": "fc880f74-cf03-4a7a-93da-74c506157023",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 11:10:17",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 7,
            "mac": "52:54:00:6c:6a:ac",
            "memory": 2048,
            "name": "Ubuntu-16-04",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": null,
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 11:10:37.793878",
                    "id": 5,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [
                        {
                            "created_at": "2018-02-22 14:24:51.886326",
                            "id": 5,
                            "master_id": 5,
                            "master_uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
                            "pool": "",
                            "size": 60,
                            "type": "snapshot",
                            "updated_at": null,
                            "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a2018-02-22-14-24-32"
                        }
                    ],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a"
                }
            ],
            "tags": null,
            "updated_at": "2018-02-22 14:24:14",
            "user_id": 8,
            "username": "example",
            "uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
            "vcpu": 2
        },
        {
            "backup": false,
            "billing_account": 6,
            "created_at": "2018-02-22 14:24:30",
            "description": "",
            "hostname": "hostname",
            "hypervisor_id": null,
            "id": 11,
            "mac": "52:54:00:59:44:d1",
            "memory": 2048,
            "name": "Name of the Clone",
            "os_name": "ubuntu",
            "os_version": "16.04",
            "private_ipv4": "",
            "public_ipv4": "80.64.107.49",
            "status": "running",
            "storage": [
                {
                    "created_at": "2018-02-22 14:24:30.312877",
                    "id": 9,
                    "name": "sda",
                    "pool": "default2",
                    "primary": true,
                    "public_ipv4": null,
                    "replica": [],
                    "shared": false,
                    "size": 20,
                    "type": "block",
                    "updated_at": null,
                    "user_id": 8,
                    "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43"
                }
            ],
            "tags": null,
            "updated_at": null,
            "user_id": 8,
            "username": "example",
            "uuid": "d582f16a-013b-4a23-8463-c66bbbc96c43",
            "vcpu": 2
        }
    ]
    

    Get all resources actively associated with billing account

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/billing_resources

    Query Parameters

    Parameter Default Type
    id A Whole number
    resource_type vm Basic text / string value

    Get Resource Billing Info

    curl "https://api.pilw.io/v1/user-resource/resource_billing?uuid=f80b1d62-ffe4-43ef-9210-60f05445456a" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "billing_account_id": 6,
            "created_at": "2018-02-22 11:10:37",
            "id": 7,
            "resource_id": 7,
            "resource_type": "vm",
            "updated_at": null
        }
    ]
    

    Get resource billing info

    HTTP Request

    GET https://api.pilw.io/v1/user-resource/resource_billing

    Query Parameters

    Parameter Default Type
    resource_type vm Basic text / string value
    uuid A Universally Unique IDentifier

    Set Resource Billing Conf

    curl "https://api.pilw.io/v1/user-resource/resource_billing" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "billing_account_id=0" \
        -d "uuid=aaaaaaaa-0000-bbbb-1111-cccccccccccc"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "No such virtual machine exists. aaaaaaaa-0000-bbbb-1111-cccccccccccc"
        }
    }
    

    Associate resource with billing account

    HTTP Request

    POST https://api.pilw.io/v1/user-resource/resource_billing

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number
    resource_type vm Basic text / string value
    uuid A Universally Unique IDentifier

    Payment

    Delete billing account

    curl "https://api.pilw.io/v1/payment/billing_account" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "billing_account_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "Error": "Provided billing account is incorrect."
        }
    }
    

    Delete a billing account.

    HTTP Request

    DELETE https://api.pilw.io/v1/payment/billing_account

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Billing account details

    curl "https://api.pilw.io/v1/payment/billing_account?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "address_line1": "Puiestee",
        "address_line2": null,
        "city": "K\u00fcla",
        "company_name": "Firma",
        "company_reg_code": "232",
        "company_vat_number": "235235",
        "country": "EE",
        "county": "Moldaavia",
        "created": 1519219377,
        "credit_amount": 0,
        "email": "sverik@oyenetwork.com",
        "id": 6,
        "is_deleted": false,
        "post_index": "314243123",
        "title": "konto",
        "user_id": 8
    }
    

    Get billing account's detailed data.

    HTTP Request

    GET https://api.pilw.io/v1/payment/billing_account

    Query Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Update billing account

    curl "https://api.pilw.io/v1/payment/billing_account" \
        -H "apikey: meowmeowmeow" \
        -X PUT \
        -d "billing_account_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "consumer::resource_forbidden": {
                "msg": "Consumer not allowed to access resource.",
                "subtype": "resource_forbidden",
                "type": "consumer"
            }
        }
    }
    

    Update billing account's data. All existing data fields that billing account already has, must be passed along also. Otherwise this data will be deleted (PS! e-mail field can't be deleted).

    HTTP Request

    PUT https://api.pilw.io/v1/payment/billing_account

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number

    List billing accounts

    curl "https://api.pilw.io/v1/payment/billing_account/list" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "address_line1": "Puiestee",
            "address_line2": null,
            "city": "K\u00fcla",
            "company_name": "Firma",
            "company_reg_code": "232",
            "company_vat_number": "235235",
            "country": "EE",
            "county": "Moldaavia",
            "created": 1519219377,
            "credit_amount": 0,
            "email": "sverik@oyenetwork.com",
            "id": 6,
            "is_deleted": false,
            "post_index": "314243123",
            "title": "konto",
            "user_id": 8
        },
        {
            "address_line1": null,
            "address_line2": null,
            "city": null,
            "company_name": null,
            "company_reg_code": null,
            "company_vat_number": null,
            "country": null,
            "county": null,
            "created": 1521728822,
            "credit_amount": 0,
            "email": "val",
            "id": 129075,
            "is_deleted": false,
            "post_index": null,
            "title": "val",
            "user_id": 8
        }
    ]
    

    List billing accounts attached to user. Additionally 'show_shadow' attribute may be added (any value) to get also deleted accounts

    HTTP Request

    GET https://api.pilw.io/v1/payment/billing_account/list

    Set default billing account

    curl "https://api.pilw.io/v1/payment/billing_account/set_default" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "billing_account_id=129072"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Set billing account as default account.

    HTTP Request

    POST https://api.pilw.io/v1/payment/billing_account/set_default

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Get unpaid amount

    curl "https://api.pilw.io/v1/payment/billing_account/unpaid_amount?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "message": 59.96
    }
    

    Get billing account's unpaid total amount (with VAT included). This is unpaid amount of all invoices who's status is not 'paid'.

    HTTP Request

    GET https://api.pilw.io/v1/payment/billing_account/unpaid_amount

    Query Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Calculate totals

    curl "https://api.pilw.io/v1/payment/calculate_totals?amounts=100&amounts=354.37" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "discount": 0.0,
        "subtotal": 454.37,
        "total": 545.24,
        "vat_tax": 90.87
    }
    

    Calculate 'subtotal', 'vat_tax' and 'total' according to provided invoice record amounts. Optionally specify vat_percentage to calculate with custom VAT (defaults to 20).

    HTTP Request

    GET https://api.pilw.io/v1/payment/calculate_totals

    Query Parameters

    Parameter Default Type
    amounts Multiple Values
    vat_percentage 20 A Whole number

    Remove credit card

    curl "https://api.pilw.io/v1/payment/card" \
        -H "apikey: meowmeowmeow" \
        -X DELETE \
        -d "payment_object_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "consumer::resource_forbidden": {
                "msg": "Consumer not allowed to access resource.",
                "subtype": "resource_forbidden",
                "type": "consumer"
            }
        }
    }
    

    Remove credit card.

    HTTP Request

    DELETE https://api.pilw.io/v1/payment/card

    Form Parameters

    Parameter Default Type
    payment_object_id A Whole number

    Credit card details

    curl "https://api.pilw.io/v1/payment/card?payment_object_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "additional_data": "{\"id\": \"pay_e566cf1e776c91857c5d55c0\", \"type\": \"creditcard\", \"client\": {\"id\": \"client_57b586239757f585c569\", \"email\": \"sverik@oyenetwork.com\", \"description\": null, \"app_id\": null, \"updated_at\": 1507032614, \"created_at\": 1507032614, \"payment\": [\"pay_d2338c36103cd678b657c852\", \"pay_876184a6380bdb25b2a617c2\", \"pay_92572e33a6cf41be8a0ba811\", \"pay_ff5129221ed980d5ced974c3\", \"pay_f0da159c756fcdb8d2f8fa77\", \"pay_80f3731cff7b0157185a314a\", \"pay_948ede1174fa52d79e72b7a9\", \"pay_8c3735b74d9649d2f742e77a\", \"pay_44a5f1d83299ef5488e83b88\", \"pay_77c695e0c85c1a87046cf90d\", \"pay_e0e496b06f7c706ce9f2c21f\", \"pay_bd68fca53a2b7ce493e77f7b\", \"pay_2ecd6ea760e6d0b4b6604d5c\", \"pay_693029dd67472dec44d08320\", \"pay_bcd100532afcac9207c327c3\", \"pay_ea5613ace7154061d95ba76f\", \"pay_d72aa93d0143f1b8d7ffa119\", \"pay_caec3bf657e124e01de21411\", \"pay_ac3756da59891e9986371ae5\", \"pay_6838cf521becb9c290a22264\", \"pay_5344aeabbf04ef507df2d545\", \"pay_1ef76358a95d797cf6741438\", \"pay_7662a834fa17f3dbc7ecced3\", \"pay_e566cf1e776c91857c5d55c0\"], \"subscription\": null}, \"card_type\": \"visa\", \"country\": \"DE\", \"expire_month\": \"12\", \"expire_year\": \"2029\", \"card_holder\": \"Inimene\", \"last4\": \"1111\", \"updated_at\": 1519219380, \"created_at\": 1519219378, \"app_id\": null, \"is_recurring\": true, \"is_usable_for_preauthorization\": true, \"code\": null, \"account\": null, \"holder\": null}",
        "billing_account_id": 6,
        "billing_account_processor_identifier_id": 6,
        "created": 1519219380,
        "id": 6,
        "identifier": "pay_e566cf1e776c91857c5d55c0",
        "is_primary": true,
        "is_verified": true,
        "valid_thru": 1893369600
    }
    

    Get payment method details.

    HTTP Request

    GET https://api.pilw.io/v1/payment/card

    Query Parameters

    Parameter Default Type
    payment_object_id A Whole number

    Add credit card

    curl "https://api.pilw.io/v1/payment/card" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "billing_account_id=0" \
        -d "token=val"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "consumer::resource_forbidden": {
                "msg": "Consumer not allowed to access resource.",
                "subtype": "resource_forbidden",
                "type": "consumer"
            }
        }
    }
    

    Add new credit card. Possible to add primary and secodary (failover) card.

    Steps involved when add a new card: - attach payment object to the billing account (credit card) - check payment object validity

    HTTP Request

    POST https://api.pilw.io/v1/payment/card

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number
    token Basic text / string value

    List credit cards

    curl "https://api.pilw.io/v1/payment/card/list?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "additional_data": "{\"id\": \"pay_e566cf1e776c91857c5d55c0\", \"type\": \"creditcard\", \"client\": {\"id\": \"client_57b586239757f585c569\", \"email\": \"sverik@oyenetwork.com\", \"description\": null, \"app_id\": null, \"updated_at\": 1507032614, \"created_at\": 1507032614, \"payment\": [\"pay_d2338c36103cd678b657c852\", \"pay_876184a6380bdb25b2a617c2\", \"pay_92572e33a6cf41be8a0ba811\", \"pay_ff5129221ed980d5ced974c3\", \"pay_f0da159c756fcdb8d2f8fa77\", \"pay_80f3731cff7b0157185a314a\", \"pay_948ede1174fa52d79e72b7a9\", \"pay_8c3735b74d9649d2f742e77a\", \"pay_44a5f1d83299ef5488e83b88\", \"pay_77c695e0c85c1a87046cf90d\", \"pay_e0e496b06f7c706ce9f2c21f\", \"pay_bd68fca53a2b7ce493e77f7b\", \"pay_2ecd6ea760e6d0b4b6604d5c\", \"pay_693029dd67472dec44d08320\", \"pay_bcd100532afcac9207c327c3\", \"pay_ea5613ace7154061d95ba76f\", \"pay_d72aa93d0143f1b8d7ffa119\", \"pay_caec3bf657e124e01de21411\", \"pay_ac3756da59891e9986371ae5\", \"pay_6838cf521becb9c290a22264\", \"pay_5344aeabbf04ef507df2d545\", \"pay_1ef76358a95d797cf6741438\", \"pay_7662a834fa17f3dbc7ecced3\", \"pay_e566cf1e776c91857c5d55c0\"], \"subscription\": null}, \"card_type\": \"visa\", \"country\": \"DE\", \"expire_month\": \"12\", \"expire_year\": \"2029\", \"card_holder\": \"Inimene\", \"last4\": \"1111\", \"updated_at\": 1519219380, \"created_at\": 1519219378, \"app_id\": null, \"is_recurring\": true, \"is_usable_for_preauthorization\": true, \"code\": null, \"account\": null, \"holder\": null}",
            "billing_account_id": 6,
            "billing_account_processor_identifier_id": 6,
            "created": 1519219380,
            "id": 6,
            "identifier": "pay_e566cf1e776c91857c5d55c0",
            "is_primary": true,
            "is_verified": true,
            "valid_thru": 1893369600
        }
    ]
    

    Get list of credit cards attached to billing account.

    HTTP Request

    GET https://api.pilw.io/v1/payment/card/list

    Query Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Set card as primary

    curl "https://api.pilw.io/v1/payment/card/set_primary" \
        -H "apikey: meowmeowmeow" \
        -X PUT \
        -d "payment_object_id=6"
    

    The above command returns JSON structured like this:

    {
        "success": true
    }
    

    Set credit card specified by id as 'primary'. Throws exception if specified card is not validated. Unmarks previous 'primary' card.

    HTTP Request

    PUT https://api.pilw.io/v1/payment/card/set_primary

    Form Parameters

    Parameter Default Type
    payment_object_id A Whole number

    List credit

    curl "https://api.pilw.io/v1/payment/credit/list?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "amount": -3.44,
            "billing_account_id": 129072,
            "created": 1543627933,
            "description": "Invoice payment",
            "id": 32
        },
        {
            "amount": -0.15,
            "billing_account_id": 129072,
            "created": 1539162090,
            "description": "Invoice payment",
            "id": 21
        },
        {
            "amount": -2.64,
            "billing_account_id": 129072,
            "created": 1539092800,
            "description": "Invoice payment",
            "id": 20
        },
        {
            "amount": -3.77,
            "billing_account_id": 129072,
            "created": 1538357520,
            "description": "Invoice payment",
            "id": 12
        },
        {
            "amount": 10.0,
            "billing_account_id": 129072,
            "created": 1537363992,
            "description": "First billing account",
            "id": 1
        }
    ]
    

    Show data about billing account's credit amount and individual records.

    HTTP Request

    GET https://api.pilw.io/v1/payment/credit/list

    Query Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Invoice details

    curl "https://api.pilw.io/v1/payment/invoice?invoice_id=1" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
        "billing_account_id": 6,
        "created": 1519309247,
        "id": 1,
        "name": "Invoice <nr>",
        "padded_id": "001",
        "period_end": 1519862400,
        "period_start": 1517443200,
        "records_list": [
            {
                "amount": 0.02602,
                "created": 1519309247,
                "descr": "TODO",
                "id": 1,
                "invoice_id": 1,
                "item_price": 0.02602,
                "name": "DEBUGXYZ-buntu, 2 CPUs, 2 GB RAM, null GB disk",
                "qty": 1,
                "qty_unit": "h"
            },
            {
                "amount": 0.87927,
                "created": 1519309247,
                "descr": "TODO",
                "id": 2,
                "invoice_id": 1,
                "item_price": 0.04187,
                "name": "buntu-b-Parool123, 4 CPUs, 1 GB RAM, 30 GB disk",
                "qty": 21,
                "qty_unit": "h"
            },
            {
                "amount": 0.08646,
                "created": 1519309247,
                "descr": "TODO",
                "id": 3,
                "invoice_id": 1,
                "item_price": 0.02882,
                "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                "qty": 3,
                "qty_unit": "h"
            },
            {
                "amount": 0.1441,
                "created": 1519309247,
                "descr": "TODO",
                "id": 4,
                "invoice_id": 1,
                "item_price": 0.02882,
                "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk",
                "qty": 5,
                "qty_unit": "h"
            },
            {
                "amount": 0.08646,
                "created": 1519309247,
                "descr": "TODO",
                "id": 5,
                "invoice_id": 1,
                "item_price": 0.02882,
                "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                "qty": 3,
                "qty_unit": "h"
            }
        ],
        "status": 10,
        "totals": {
            "discount": 0.0,
            "subtotal": 1.23,
            "total": 1.48,
            "vat_tax": 0.25
        },
        "transaction_list": [
            {
                "additional_data": "{\"id\": \"tran_707a24d54b2432688c2e2a68b12a\", \"amount\": 147, \"origin_amount\": 147, \"status\": \"closed\", \"description\": \"Pay reminder for invoice #1: 'Invoice <nr>'\", \"livemode\": false, \"refunds\": null, \"client\": {\"id\": \"client_57b586239757f585c569\", \"email\": \"sverik@oyenetwork.com\", \"description\": null, \"app_id\": null, \"updated_at\": 1507032614, \"created_at\": 1507032614, \"payment\": [\"pay_d2338c36103cd678b657c852\", \"pay_876184a6380bdb25b2a617c2\", \"pay_92572e33a6cf41be8a0ba811\", \"pay_ff5129221ed980d5ced974c3\", \"pay_f0da159c756fcdb8d2f8fa77\", \"pay_80f3731cff7b0157185a314a\", \"pay_948ede1174fa52d79e72b7a9\", \"pay_8c3735b74d9649d2f742e77a\", \"pay_44a5f1d83299ef5488e83b88\", \"pay_77c695e0c85c1a87046cf90d\", \"pay_e0e496b06f7c706ce9f2c21f\", \"pay_bd68fca53a2b7ce493e77f7b\", \"pay_2ecd6ea760e6d0b4b6604d5c\", \"pay_693029dd67472dec44d08320\", \"pay_bcd100532afcac9207c327c3\", \"pay_ea5613ace7154061d95ba76f\", \"pay_d72aa93d0143f1b8d7ffa119\", \"pay_caec3bf657e124e01de21411\", \"pay_ac3756da59891e9986371ae5\", \"pay_6838cf521becb9c290a22264\", \"pay_5344aeabbf04ef507df2d545\", \"pay_1ef76358a95d797cf6741438\", \"pay_7662a834fa17f3dbc7ecced3\", \"pay_e566cf1e776c91857c5d55c0\", \"pay_c4c936c9bbbe12d9e481cad5\"], \"subscription\": null}, \"currency\": \"EUR\", \"created_at\": 1519309499, \"updated_at\": 1519309499, \"response_code\": 20000, \"short_id\": \"0000.9999.0000\", \"is_fraud\": false, \"invoices\": [], \"app_id\": null, \"preauthorization\": null, \"fees\": [], \"payment\": {\"id\": \"pay_e566cf1e776c91857c5d55c0\", \"type\": \"creditcard\", \"client\": \"client_57b586239757f585c569\", \"card_type\": \"visa\", \"country\": \"DE\", \"expire_month\": \"12\", \"expire_year\": \"2029\", \"card_holder\": \"Inimene\", \"last4\": \"1111\", \"updated_at\": 1519219380, \"created_at\": 1519219378, \"app_id\": null, \"is_recurring\": true, \"is_usable_for_preauthorization\": true, \"code\": null, \"account\": null, \"holder\": null}, \"mandate_reference\": null, \"is_refundable\": true, \"is_markable_as_fraud\": true}",
                "amount": 1.48,
                "created": 1519309499,
                "id": 1,
                "identifier": "tran_707a24d54b2432688c2e2a68b12a",
                "payment_object_id": 6
            }
        ]
    }
    

    Get invoice details.

    Invoice Status Code Description
    5 Unpaid
    10 Paid

    HTTP Request

    GET https://api.pilw.io/v1/payment/invoice

    Query Parameters

    Parameter Default Type
    invoice_id A Whole number

    List invoices

    curl "https://api.pilw.io/v1/payment/invoice/list?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
            "billing_account_id": 6,
            "created": 1520341071,
            "id": 3782543,
            "name": null,
            "padded_id": "003782543",
            "period_end": 1522540800,
            "period_start": 1519862400,
            "records_list": [
                {
                    "amount": 0.3696,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 67,
                    "invoice_id": 3782543,
                    "item_price": 0.0028,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 132,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.3696,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 68,
                    "invoice_id": 3782543,
                    "item_price": 0.0028,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 132,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.3696,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 69,
                    "invoice_id": 3782543,
                    "item_price": 0.0028,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 132,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.3696,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 70,
                    "invoice_id": 3782543,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 132,
                    "qty_unit": "h"
                },
                {
                    "amount": 1.1088,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 71,
                    "invoice_id": 3782543,
                    "item_price": 0.0084,
                    "name": "Ubuntu-16-04, snapshots",
                    "qty": 132,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.3696,
                    "created": 1520341071,
                    "descr": "TODO",
                    "id": 72,
                    "invoice_id": 3782543,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 132,
                    "qty_unit": "h"
                }
            ],
            "status": 5,
            "totals": {
                "discount": 0.0,
                "subtotal": 2.96,
                "total": 3.55,
                "vat_tax": 0.59
            },
            "transaction_list": []
        },
        {
            "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
            "billing_account_id": 6,
            "created": 1520341040,
            "id": 3782542,
            "name": null,
            "padded_id": "003782542",
            "period_end": 1519862400,
            "period_start": 1517443200,
            "records_list": [
                {
                    "amount": 0.02602,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 54,
                    "invoice_id": 3782542,
                    "item_price": 0.02602,
                    "name": "DEBUGXYZ-buntu, 2 CPUs, 2 GB RAM, null GB disk",
                    "qty": 1,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.87927,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 55,
                    "invoice_id": 3782542,
                    "item_price": 0.04187,
                    "name": "buntu-b-Parool123, 4 CPUs, 1 GB RAM, 30 GB disk",
                    "qty": 21,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.0348,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 56,
                    "invoice_id": 3782542,
                    "item_price": 0.02882,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 57,
                    "invoice_id": 3782542,
                    "item_price": 0.0028,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.12126,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 58,
                    "invoice_id": 3782542,
                    "item_price": 0.02882,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 143,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 59,
                    "invoice_id": 3782542,
                    "item_price": 0.0028,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.1789,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 60,
                    "invoice_id": 3782542,
                    "item_price": 0.02882,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 145,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 61,
                    "invoice_id": 3782542,
                    "item_price": 0.0028,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.12126,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 62,
                    "invoice_id": 3782542,
                    "item_price": 0.02882,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 143,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 63,
                    "invoice_id": 3782542,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 1.2936,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 64,
                    "invoice_id": 3782542,
                    "item_price": 0.0084,
                    "name": "Ubuntu-16-04, snapshots",
                    "qty": 154,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.0348,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 65,
                    "invoice_id": 3782542,
                    "item_price": 0.02882,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1520341040,
                    "descr": "TODO",
                    "id": 66,
                    "invoice_id": 3782542,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                }
            ],
            "status": 5,
            "totals": {
                "discount": 0.0,
                "subtotal": 22.89,
                "total": 27.47,
                "vat_tax": 4.58
            },
            "transaction_list": []
        },
        {
            "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
            "billing_account_id": 6,
            "created": 1520241350,
            "id": 3782541,
            "name": "Invoice",
            "padded_id": "003782541",
            "period_end": 1522540800,
            "period_start": 1519862400,
            "records_list": [
                {
                    "amount": 0.294,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 48,
                    "invoice_id": 3782541,
                    "item_price": 0.0028,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 105,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.294,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 49,
                    "invoice_id": 3782541,
                    "item_price": 0.0028,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 105,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.294,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 50,
                    "invoice_id": 3782541,
                    "item_price": 0.0028,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 105,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.294,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 51,
                    "invoice_id": 3782541,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 105,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.882,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 52,
                    "invoice_id": 3782541,
                    "item_price": 0.0084,
                    "name": "Ubuntu-16-04, snapshots",
                    "qty": 105,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.294,
                    "created": 1520241350,
                    "descr": "TODO",
                    "id": 53,
                    "invoice_id": 3782541,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 105,
                    "qty_unit": "h"
                }
            ],
            "status": 5,
            "totals": {
                "discount": 0.0,
                "subtotal": 2.36,
                "total": 2.83,
                "vat_tax": 0.47
            },
            "transaction_list": []
        },
        {
            "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
            "billing_account_id": 6,
            "created": 1519867923,
            "id": 6,
            "name": "Invoice <nr>",
            "padded_id": "006",
            "period_end": 1519862400,
            "period_start": 1517443200,
            "records_list": [
                {
                    "amount": 4.0348,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 16,
                    "invoice_id": 6,
                    "item_price": 0.02882,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 17,
                    "invoice_id": 6,
                    "item_price": 0.0028,
                    "name": "Name of the Clone, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.0348,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 18,
                    "invoice_id": 6,
                    "item_price": 0.02882,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 19,
                    "invoice_id": 6,
                    "item_price": 0.0028,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.0348,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 20,
                    "invoice_id": 6,
                    "item_price": 0.02882,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 21,
                    "invoice_id": 6,
                    "item_price": 0.0028,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.12126,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 22,
                    "invoice_id": 6,
                    "item_price": 0.02882,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 143,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 23,
                    "invoice_id": 6,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                },
                {
                    "amount": 1.2936,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 24,
                    "invoice_id": 6,
                    "item_price": 0.0084,
                    "name": "Ubuntu-16-04, snapshots",
                    "qty": 154,
                    "qty_unit": "h"
                },
                {
                    "amount": 4.0348,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 25,
                    "invoice_id": 6,
                    "item_price": 0.02882,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 140,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.0392,
                    "created": 1519867923,
                    "descr": "TODO",
                    "id": 26,
                    "invoice_id": 6,
                    "item_price": 0.0028,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk, stopped",
                    "qty": 14,
                    "qty_unit": "h"
                }
            ],
            "status": 5,
            "totals": {
                "discount": 0.0,
                "subtotal": 21.76,
                "total": 26.11,
                "vat_tax": 4.35
            },
            "transaction_list": []
        },
        {
            "account_snapshot": "{\"address_line1\": \"Puiestee\", \"address_line2\": null, \"city\": \"K\\u00fcla\", \"company_name\": \"Firma\", \"company_reg_code\": \"232\", \"company_vat_number\": \"235235\", \"country\": \"EE\", \"county\": \"Moldaavia\", \"created\": 1519219377, \"credit_amount\": 0, \"email\": \"sverik@oyenetwork.com\", \"id\": 6, \"is_deleted\": false, \"post_index\": \"314243123\", \"title\": \"konto\", \"user_id\": 8}",
            "billing_account_id": 6,
            "created": 1519309247,
            "id": 1,
            "name": "Invoice <nr>",
            "padded_id": "001",
            "period_end": 1519862400,
            "period_start": 1517443200,
            "records_list": [
                {
                    "amount": 0.02602,
                    "created": 1519309247,
                    "descr": "TODO",
                    "id": 1,
                    "invoice_id": 1,
                    "item_price": 0.02602,
                    "name": "DEBUGXYZ-buntu, 2 CPUs, 2 GB RAM, null GB disk",
                    "qty": 1,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.87927,
                    "created": 1519309247,
                    "descr": "TODO",
                    "id": 2,
                    "invoice_id": 1,
                    "item_price": 0.04187,
                    "name": "buntu-b-Parool123, 4 CPUs, 1 GB RAM, 30 GB disk",
                    "qty": 21,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.08646,
                    "created": 1519309247,
                    "descr": "TODO",
                    "id": 3,
                    "invoice_id": 1,
                    "item_price": 0.02882,
                    "name": "Ubuntu-3-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 3,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.1441,
                    "created": 1519309247,
                    "descr": "TODO",
                    "id": 4,
                    "invoice_id": 1,
                    "item_price": 0.02882,
                    "name": "DEBUGXYZ-2-buntu, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 5,
                    "qty_unit": "h"
                },
                {
                    "amount": 0.08646,
                    "created": 1519309247,
                    "descr": "TODO",
                    "id": 5,
                    "invoice_id": 1,
                    "item_price": 0.02882,
                    "name": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
                    "qty": 3,
                    "qty_unit": "h"
                }
            ],
            "status": 10,
            "totals": {
                "discount": 0.0,
                "subtotal": 1.23,
                "total": 1.48,
                "vat_tax": 0.25
            },
            "transaction_list": [
                {
                    "additional_data": "{\"id\": \"tran_707a24d54b2432688c2e2a68b12a\", \"amount\": 147, \"origin_amount\": 147, \"status\": \"closed\", \"description\": \"Pay reminder for invoice #1: 'Invoice <nr>'\", \"livemode\": false, \"refunds\": null, \"client\": {\"id\": \"client_57b586239757f585c569\", \"email\": \"sverik@oyenetwork.com\", \"description\": null, \"app_id\": null, \"updated_at\": 1507032614, \"created_at\": 1507032614, \"payment\": [\"pay_d2338c36103cd678b657c852\", \"pay_876184a6380bdb25b2a617c2\", \"pay_92572e33a6cf41be8a0ba811\", \"pay_ff5129221ed980d5ced974c3\", \"pay_f0da159c756fcdb8d2f8fa77\", \"pay_80f3731cff7b0157185a314a\", \"pay_948ede1174fa52d79e72b7a9\", \"pay_8c3735b74d9649d2f742e77a\", \"pay_44a5f1d83299ef5488e83b88\", \"pay_77c695e0c85c1a87046cf90d\", \"pay_e0e496b06f7c706ce9f2c21f\", \"pay_bd68fca53a2b7ce493e77f7b\", \"pay_2ecd6ea760e6d0b4b6604d5c\", \"pay_693029dd67472dec44d08320\", \"pay_bcd100532afcac9207c327c3\", \"pay_ea5613ace7154061d95ba76f\", \"pay_d72aa93d0143f1b8d7ffa119\", \"pay_caec3bf657e124e01de21411\", \"pay_ac3756da59891e9986371ae5\", \"pay_6838cf521becb9c290a22264\", \"pay_5344aeabbf04ef507df2d545\", \"pay_1ef76358a95d797cf6741438\", \"pay_7662a834fa17f3dbc7ecced3\", \"pay_e566cf1e776c91857c5d55c0\", \"pay_c4c936c9bbbe12d9e481cad5\"], \"subscription\": null}, \"currency\": \"EUR\", \"created_at\": 1519309499, \"updated_at\": 1519309499, \"response_code\": 20000, \"short_id\": \"0000.9999.0000\", \"is_fraud\": false, \"invoices\": [], \"app_id\": null, \"preauthorization\": null, \"fees\": [], \"payment\": {\"id\": \"pay_e566cf1e776c91857c5d55c0\", \"type\": \"creditcard\", \"client\": \"client_57b586239757f585c569\", \"card_type\": \"visa\", \"country\": \"DE\", \"expire_month\": \"12\", \"expire_year\": \"2029\", \"card_holder\": \"Inimene\", \"last4\": \"1111\", \"updated_at\": 1519219380, \"created_at\": 1519219378, \"app_id\": null, \"is_recurring\": true, \"is_usable_for_preauthorization\": true, \"code\": null, \"account\": null, \"holder\": null}, \"mandate_reference\": null, \"is_refundable\": true, \"is_markable_as_fraud\": true}",
                    "amount": 1.48,
                    "created": 1519309499,
                    "id": 1,
                    "identifier": "tran_707a24d54b2432688c2e2a68b12a",
                    "payment_object_id": 6
                }
            ]
        }
    ]
    

    List billing account's invoices.

    HTTP Request

    GET https://api.pilw.io/v1/payment/invoice/list

    Query Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Pay all

    curl "https://api.pilw.io/v1/payment/pay_all" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "billing_account_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "consumer::resource_forbidden": {
                "msg": "Consumer not allowed to access resource.",
                "subtype": "resource_forbidden",
                "type": "consumer"
            }
        }
    }
    

    Pay all billing account's unpaid invoices. Pays oldest invoices first.

    HTTP Request

    POST https://api.pilw.io/v1/payment/pay_all

    Form Parameters

    Parameter Default Type
    billing_account_id A Whole number

    Pay amount

    curl "https://api.pilw.io/v1/payment/pay_amount" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "billing_account_id=6" \
        -d "amount=10"
    

    The above command returns JSON structured like this:

    {
        "amount_left": 0.0,
        "amount_used": 10.0,
        "error_log": "",
        "message": "All amount were used. Invoices (#6) were paid fully or partially.",
        "paid_invoices": [
            6
        ],
        "success": true
    }
    

    Pay the amount specified with parameters. Pays billing account's oldest unpaid invoices first.

    HTTP Request

    POST https://api.pilw.io/v1/payment/pay_amount

    Form Parameters

    Parameter Default Type
    amount A decimal number
    billing_account_id A Whole number

    Pay invoice

    curl "https://api.pilw.io/v1/payment/pay_invoice" \
        -H "apikey: meowmeowmeow" \
        -X POST \
        -d "invoice_id=0"
    

    The above command returns JSON structured like this:

    {
        "errors": {
            "consumer::resource_forbidden": {
                "msg": "Consumer not allowed to access resource.",
                "subtype": "resource_forbidden",
                "type": "consumer"
            }
        }
    }
    

    Pay invoice specified by id.

    HTTP Request

    POST https://api.pilw.io/v1/payment/pay_invoice

    Form Parameters

    Parameter Default Type
    invoice_id A Whole number

    Pricing

    Pricing policy

    curl "https://api.pilw.io/v1/pricing/policy" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    {
        "policy": [
            {
                "numCpus": 1,
                "policyId": 1001,
                "price": 0.00521,
                "resourceType": "CPU",
                "serviceNameUserFriendly": "1 CPU"
            },
            {
                "megsRam": 512,
                "policyId": 1010,
                "price": 0.001645,
                "resourceType": "RAM",
                "serviceNameUserFriendly": "0.5 GB RAM"
            },
            {
                "megsRam": 1024,
                "policyId": 1011,
                "price": 0.00329,
                "resourceType": "RAM",
                "serviceNameUserFriendly": "1 GB RAM"
            },
            {
                "policyId": 1021,
                "price": 3.42e-05,
                "resourceType": "STORAGE",
                "serviceNameInUptime": "backup",
                "serviceNameUserFriendly": "Backup"
            },
            {
                "policyId": 1022,
                "price": 0.0001,
                "resourceType": "STORAGE",
                "serviceNameInUptime": "snapshot",
                "serviceNameUserFriendly": "Snapshot"
            },
            {
                "policyId": 1023,
                "price": 0.0001,
                "resourceType": "STORAGE",
                "serviceNameInUptime": "main",
                "serviceNameUserFriendly": "Storage"
            },
            {
                "policyId": 1030,
                "price": 0.00548,
                "resourceType": "LICENSE",
                "serviceNameInUptime": "windows",
                "serviceNameUserFriendly": "Windows license per core per hour"
            },
            {
                "policyId": 1040,
                "price": 3.42e-05,
                "resourceType": "OBJECT_STORAGE",
                "serviceNameInUptime": "object_storage",
                "serviceNameUserFriendly": "Object storage per gigabyte per hour"
            }
        ]
    }
    

    Policy that describes how resources are priced.

    HTTP Request

    GET https://api.pilw.io/v1/pricing/policy

    Charging

    Get Resource Usage

    curl "https://api.pilw.io/v1/charging/usage?billing_account_id=6" \
        -H "apikey: meowmeowmeow" \
        -X GET
    

    The above command returns JSON structured like this:

    [
        {
            "billing_account_id": 6,
            "configurations": [
                {
                    "cpus": 2,
                    "disk_size_GB": 20,
                    "os_name": "ubuntu",
                    "ram_MB": 2048,
                    "vm_name": "Ubuntu-16-04"
                },
                {
                    "cpus": 2,
                    "disk_size_GB": null,
                    "os_name": null,
                    "ram_MB": 2048,
                    "vm_name": "Ubuntu-16-04"
                }
            ],
            "cost": 0.08646,
            "description": "Ubuntu-16-04, 2 CPUs, 2 GB RAM, 20 GB disk",
            "hours": 3.0,
            "owner_uuid": "f80b1d62-ffe4-43ef-9210-60f05445456a",
            "price": 0.02882,
            "price_unit": "h",
            "uptime_types": [
                "VM_COMPUTE",
                "VM_RUNNING",
                "MAIN_STORAGE"
            ],
            "user_id": 8
        }
    ]
    

    Resources, prices and costs for the specified billing account, for the current month.

    HTTP Request

    GET https://api.pilw.io/v1/charging/usage

    Query Parameters

    Parameter Default Type
    billing_account_id integer