Introduction

The API uses OAuth2 as authentication mechanism. You will need to use the created application keys with client_credentials OAuth2 flow.

POST https://my.hostafrica.com/vps_reseller_provider/public/oauth/token
Scopes
access
products
service

Responses

All API endpoints return the JSON representation of the resources in the following format:

{
  "message" : string,
  "success" : string,
  "data"    : string
}

The message attribute contains a message commonly used to indicate errors or, in the case of deleting a resource, success that the resource was properly deleted.

The success attribute describes if the transaction was successful or not.

The data attribute contains any other metadata associated with the response. This will be an escaped string containing JSON data.

Status Codes

HOSTAFRICA returns the following status codes in its API:

Status Code Description
200 OK
400 BAD REQUEST
404 NOT FOUND
500 INTERNAL SERVER ERROR

API Endpoints

Test Connection

This API checks if Oauth2 token is valid with HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/test-connection
Scope
access
Parameter Type Description

GET Products

This API provides available products.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/products
Scope
products
Parameter Type Description

Successful Response Data Example:

{
    "id": "cbbd4ada-f8b5-4fd5-b50d-0d2b57341c33",
    "name": "Cloud Server",
    "template": "linux",
    "config": {
        "ram": {
            "min": "1",
            "max": "64",
            "unit": "GB"
        },
        "ip": {
            "min": "1",
            "max": "1",
            "unit": "IP"
        },
        "cpu": {
            "min": "1",
            "max": "16",
            "unit": "vCore"
        },
        "hdd": {
            "min": "20",
            "max": "500",
            "unit": "GB"
        },
        "backup": {
            "min": "0",
            "max": "1000",
            "unit": "GB"
        }
    },
    "os_templates": [
        {
            "template_id": "d3412311-efad-4880-b265-cc9937877129",
            "name": "Centos-7"
        },
    ]
}

Create Order

This API creates new service order in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/create-order
Scope
service
Parameter Type Description
product_id string Required
domain_name string Required
template_id string Required
ram int Required
ip int Required
cpu int Required
hdd int Required
backup int Required

Successful Response Data Example:

{
    "service_id": "429ac644-111c-4400-80aa-2cdf23f6edf2",
    "username": "root",
    "password": "somePassword",
}

Create Service

This API creates service from order in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/create
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Terminate Service

This API terminates service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/terminate
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Suspend Service

This API suspends service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/suspend
Scope
service
Body Parameter Type Description
suspend_reason string Required
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Unsuspend Service

This API unsuspends service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/unsuspend
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Start Service

This API starts service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/start
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Stop Service

This API stops service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/stop
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Restart Service

This API restarts service in HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/restart
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Service Details

This API returns updated service details from HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/details
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Successful Response Data Example:

{
    "ip": "1.1.1.1",
    "username": "root",
    "password": "&dYApo$AHs}nMPhYh"
}

Service Status

This API returns service status from HOSTAFRICA system.

POST https://my.hostafrica.com/vps_reseller_provider/public/api/v2/service/{service_id}/status
Scope
service
Body Parameter Type Description
Body Parameter Type Description
service_id string Required. (Service ID from new order response)

Successful Response Data Example:

{
    "status": "running"
}