Skip to main content

JSON Action REST APIs

Discover and use FairCom's REST APIs

This section defines the JSON actions you can POST to the FairCom server. Each action works like a REST call. The HTTPS verb is always POST, and the URI, /api, does not change.

FairCom's APIs use a simplified REST protocol called JSON Action. Each action is a remote procedure call you send as a JSON request and returns as a JSON response. The request and response are always JSON documents sent over HTTPS.

Unlike more complicated REST APIs, your code does everything through JSON. It does not use information in the URI or HTTP header, such as a query string, cookies, authtokens, and so forth. The HTTP verb is always POST, and the endpoint URI is always /api, such as https://127.0.0.1:8443/api.

FairCom's JSON Action APIs support most server features, including creating databases, tables, indexes, inserting/updating/deleting records, querying data using JSON and SQL, sending and receiving MQTT messages, configuring the server, managing accounts and access rights, configuring data connectors to retrieve and push data to devices and software, transforming inserted data automatically, running server-side JavaScript code, managing data change streaming, and so forth.

JSON Action is RESTful

.JSON Action employs the following REST features:

  1. Uniform Interface: JSON Action is RESTful because it uses a standard JSON structure in all requests and responses. JSON Action stores all information in JSON. It stores no information in the HTTP header, such as a URI, query string, cookie, authtokens, and so forth. Thus, JSON Action can work over any protocol, such as WebSocket and MQTT.

  2. Client-Server: JSON Action is RESTful because it follows the client-server pattern, where the client handles the user interface and user state, and the server manages data storage and business logic.

  3. Statelessness: JSON Action is RESTful because it follows the principle of stateless transactions between the client and server, which increases the server's scalability. Like REST, the authentication state is shared between the client and server. A few JSON actions use advanced features, such as database transactions and cursors, that must be stateful across requests.

  4. Cacheability: Static web pages can be safely cached because they change infrequently and provide only one path to change each page. Server APIs cannot be safely cached because they change data rapidly in complex ways and provide multiple paths to change the same data. The creator of REST wrongly assumed that API servers can be cached like web servers. Thus, JSON Actions are intentionally not cacheable and use only the POST verb to enforce the uncacheability of API actions.

  5. Layered System: JSON Action is RESTful because it supports multiple layers between the client and server, including load balancers, proxies, API gateways, and so forth.

  6. Code on Demand (Optional): JSON Actions never send executable code to the client to extend its functionality. This is a potential security issue, and it assumes clients can run JavaScript code. JSON Action is secure and supports all types of application servers, not just JavaScript ones.

FairCom's APIs use a simplified REST protocol called JSON Action, which involves sending JSON requests and receiving JSON responses over HTTPS. All information is contained within the JSON document, not in the URI or HTTP header. The HTTP verb is always POST, and the endpoint URI is always /api. JSON Action adheres to the defining features of REST: uniform interface, client-server, statelessness, and layered system. Unlike naive implementations of REST, JSON Action is intentionally not cacheable and does not send code to clients.

FairCom JSON Action API

JSON Action API

JSON Action is REST

JSON Action API is RESTful

FairCom REST API

FairCom RESTful API

REST API

RESTful API

REST

RESTful

API

Simplified REST protocol

RESTful JSON requests

RESTful JSON responses

RESTful HTTPS API

RESTful HTTP API

Stateless REST API

Client-server REST API

Standard JSON API

Simple JSON API

Simple REST API

Uniform Interface REST feature

Client-server REST feature

Statelessness REST feature

Cacheable REST feature

Uncacheable REST feature

Layered System REST feature

Code on Demand REST feature

JSON Action has a uniform Interface

JSON Action is client-server

JSON Action is stateless

JSON Action is not cacheable

JSON Action is uncacheable

JSON Action uses the HTTP layered system

JSON Action does not deliver code on demand

JSON Action is secure

JSON Action is RPC

JSON Action is a Remote Procedure Call

RPC

FairCom RPC

RPC API

FairCom RPC API

Remote procedure call

FairCom Remote Procedure Call

Remote procedure call API

FairCom Remote Procedure Call API

Secure REST API

Secure RESTful API

Scalable REST API

Scalable RESTful API

FairCom JSON over HTTP

FairCom JSON over HTTPS

FairCom JSON over HTTP API

FairCom JSON over HTTPS API

JSON over HTTP REST API

JSON over HTTP RESTful API

JSON over HTTP

JSON over HTTPS REST API

JSON over HTTPS RESTful API

JSON over HTTPS

HTTP POST

HTTPS POST

HTTP PUT

HTTP GET

HTTP PATH

HTTP DELETE

HTTP URL

HTTP URI

HTTP IRI

REST URL

REST URI

REST IRI

URL

URI

IRI

JSON over WebSocket

JSON over MQTT

JSON API over WebSocket

JSON API over MQTT

Header

Cookies

Query string

AuthToken

JSON

HTTP Cookies

HTTP Query string

HTTP AuthToken

HTTP Header

REST Header

REST Cookies

REST Query string

REST AuthToken

REST JSON