Nodalio API Technical Documentation

  1. Home
  2. Docs
  3. Nodalio API Technical Documentation
  4. API Usage Samples

API Usage Samples

Once the API finishes running the shortcode on your server, a response is sent back in a minified JSON format.

Shortcode ran successfully:

Once the shortcode completes its task successfully a response is sent back with an HTTP status code 200. Example of the successful shortcode response body:

Key (variable name) Value (variable content)
domain site’s domain name
result success
data console output (STDOUT)

Invalid token:

If the token cannot be validated a failed response is sent with an HTTP status code 401. Example of the failed token validation response body:

Key (variable name) Value (variable content)
result failure
data bad token

Invalid site ID:

If the site ID sent via the URL does not exist on your server an HTTP status code 404 is returned. Example of the invalid site id response body:

Key (variable name) Value (variable content)
id ID from URL
result failure
data Site not found

Shortcode exited unsuccessfully:

If the shortcode had any errors during its run-time, an HTTP status code 500 is returned. Example of the unsuccessful shortcode response body:

Key (variable name) Value (variable content)
domain site’s domain name
result failure
data exitcode: 1

Usually, the exit code will be 1 for an unsuccessful shortcode, but the exit code is sent back for debugging purposes.

 Token Validation:

Before sending API requests from different sources, you may check the validity of the token by sending a POST request with the bearer authentication token.

Token Validation format:

http://serverip:34560/v1/tokenvalidate (Currently supports POST requests only).

Token Validation reference:

  • serverip – your server’s IP address.
  • 34560 – API port.
  • v1/tokenvalidate – Token Validator endpoint.

Token validation response:

Once the API finishes checking the token, a response is sent back in a minified JSON format.

Token validated:

If the token has been validated successfully an HTTP status code 200 is returned. Example of the successfully validated token response body:

Key (variable name) Value (variable content)
result success
data Token verified

Token incorrect:

If the token could not be validated an HTTP status code 404 is returned. Example of the incorrect token response body:

Key (variable name) Value (variable content)
result failure
data Token not found

 

Was this article helpful to you? Yes No

How can we help?