API Documentation
๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ’ป

API Documentation

๐Ÿ“ฆ
Containers API
๐Ÿงพ
Account information

NodeHost is a large scale hosting provider, and we have an open no limit API that any developer with an API key can use, you can provide the API key in the URL variable api_key or as an Authorization header.

We split requests into GET and POST requests, but unless required for a resource to be uploaded all POST requests can be made as a standard GET request.

Example error response

Request

curl --location --request GET '<https://api.nodehost.cloud/get_account_info'>

Response

{
  "data": {
    "error": "true",
    "error_code": "401",
    "error_message": "The API key provided is not valid"
  },
  "system_connection": "true",
  "system_version": "v_55_65418c9",
  "system_user_id": "0",
  "system_user_username": "false"
}

This is an example of a request without the API key getting sent in the URL variable api_key or as an Authorization header. All failed requests follow the same template of error, error_code, and error_message.

Example error codes include the following:

400 - bad request 401 - not authorized 404 - content cant be found 409 - conflict 406 - not allowed, missing content 500 - server side processing error

You can expand and use the authorization header but as we use URL variables for all parameters you can just use API key and more within the URL parameters. For example you can use this example below to both supply the API key and info.

<https://api.nodehost.cloud/post_account_email_create?api_key=KEY&subject=Test&message=Hello&type=alert>

CURL

curl --location --request GET '<https://api.nodehost.cloud/get_account_info>'

GO Native

package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "<https://api.nodehost.cloud/get_account_info>"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
  }
  res, err := client.Do(req)
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)

  fmt.Println(string(body))
}

HTTP

GET /get_account_info HTTP/1.1
Host: api.nodehost.cloud

C Libcurl

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "<https://api.nodehost.cloud/get_account_info>");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);

NodeJS Native

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.nodehost.cloud',
  'path': '/get_account_info',
  'headers': {
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

PHP cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "<https://api.nodehost.cloud/get_account_info>",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;