Nodalio API Technical Documentation

  1. Home
  2. Docs
  3. Nodalio API Technical Documentation
  4. API Introduction

API Introduction

The Nodalio REST API allows you to manage your sites and server resources using conventional HTTP requests. Endpoints allow you to make calls to your server and retrieve information or execute the Nodalio shortcodes (actions).

Nodalio Database Management Structure: 

1. HTTP Request Types
2. HTTP Status Codes
3. Responses
4. Running Shortcodes

1. HTTP Request Types.

Nodalio REST API supports two major HTTP request types.

GET For simple retrieval of information about your server, the sites installed, or which backups exist for each site installed on your server.
POST For updating information, caching tools and creating new sites, aliases, etc..

2. HTTP Status Codes.

200 Successful request status code. The request was completed successfuly and the shortcode executed on the server.
500 Indicates an error has occurred when attempting to execute the shortcode. A message is attached to the response the error description.
Error description example: “Invalid shortcode” – there is usually issue with the shortcode, target domain or action/parameter sent via the API.
404 This status code is returned when the site is not found. The most common usage of this error code can be found in the sites endpoint, used to target specific sites directly.
401

Token validation issue has occurred. Mostly due to an incorrect token sent via the API. Its recommended to use the /v1/tokenvalidate endpoint to validate your token before attempting to send any API requests. This HTTP status code is also sent when the token is missing server-level permissions.

Nodalio REST API tokens have 2 permission types.

  1. Tokens used by sites have a site-level permission granting them access to the /v1/sites endpoint.
  2. Server-level tokens have access to the /v1/server endpoint, as well as, the /v1/sites endpoint. The /v1/server endpoint allows you to run any permitted shortcode on your server and have full control over all sites installed on the server.

3. Responses.

When a request is made to the Nodalio REST API a response is sent back in a JSON format. If the response is not formatted in a json format, a general error has occurred in the API.

For example, sending a GET request to the /v1/server with the shortcode “sitelist” will return 2 variables { result, data }:

1. The “result” variable will include the request success – success/failure.

2. The “data” variable: JSON formatted array of objects, each with 3 variables:

  • Site primary domain.
  • Path on the server.
  • Site ID.

Response example when running a GET request of the sitelist shortcode:


{
	"result": "success",
	"data": 
	"[
		{
		"id":		"7aff8",
		"domain":	"test.nodalio.com",
		"path":		"/var/www/test.nodalio.com"
		}, 
		{
		"id":		"ee8b4",
		"domain":	"tester-one.nodalio.com",
		"path":		"/var/www/tester-one.nodalio.com"
		}
	]"
}

4. Running Shortcodes.

The Nodalio REST API accepts the following variables:

  • shortcode_name – the shortcode name (for example, sitelist, aliaslist)
  • shortcode_action – the action sent to the shortcode.
  • shortcode_domain – only used in the /v1/server endpoint to target sites with their primary domain name, instead of using the site ID.

The variables can be sent via the request body, request parameters and url query string.

Please note: All shortcodes permitted for the site-level token permission, are permitted for the server-level permission tokens, but not vice versa.

Was this article helpful to you? Yes No

How can we help?