REST-S Messages
Introduction
The RestServerApp uses REST-S-… messages to communicate with other applications (such as the LogicApp) to handle inbound REST/HTTP(S) requests received from an external REST/HTTP(S) Client.
The following LuaApp services from the core n2svcd module handle messages
from RestServerApp.
RestLuaService(handles inbound REST requests within LogicApp)
The internal REST-S-… messages are:
REST-S-REQUESTREST-S-RESPONSE
Note that this page uses the term “on-the-wire” to refer to the sending or receiving of REST content by the RestServerApp. This term is also inclusive of the case where the message is sent by local loopback and does not physically transit a Network Interface Controller (NIC).
REST-S-REQUEST
The REST-S-REQUEST message is sent by RestServerApp to the application that is configured
for handling of inbound REST requests.
Refer to the RestServerApp Configuration documentation for more information on setting default parameters.
The attributes of the REST-S-REQUEST message are:
| Attribute | Type | Description |
|---|---|---|
rest
|
Object | Container for the parameters of the REST request that we have received. |
remote_ip
|
String | The remote dot-notation IP address from which the REST HTTP(S) request was sent. |
remote_port
|
Integer | The remote TCP/IP port from which the REST HTTP(S) request was sent. |
method
|
String | The HTTP Request method. |
uri
|
String |
The URI for which the request was received. Includes only path and query. No host/port/auth/user/fragment is present. Any special characters will be escaped using standard URI escape rules. |
path
|
String |
The URI path. Any special characters will be escaped using standard URI escape rules. |
query
|
String |
The URI query string (the part following "?" in the URI). Any special characters will be escaped using standard URI escape rules. |
content_type
|
String |
The HTTP Request Content-Type header value.
|
content
|
String | The HTTP Request content. |
http_headers
|
Array of Object |
The list of HTTP headers parsed from the HTTP Request (see below for object structure). All HTTP headers are present, including Content-Length and Content-Type.If a HTTP header was repeated in the HTTP Request, then it is repeated in this Array. |
Note that SSL and security parameters are not placed into this message.
Each object in the rest.http_headers Array for REST-S-REQUEST has the following structure.
| Field | Type | Description |
|---|---|---|
name
|
String
|
[Required] The name of the HTTP Request header. |
value
|
String
|
[Required] The full string value of the HTTP Request header. |
REST-S-RESPONSE
The REST-S-RESPONSE message is sent back to the RestServerApp by the handling application
when it is ready to send a HTTP Response to the original received HTTP Request.
The attributes of the REST-S-RESPONSE message are:
| Field | Type | Description |
|---|---|---|
success
|
0/1
|
[Required] Indicates if the request handling was successful or not. If this field is not present with value 1 then the RestServerApp
will generate an HTTP Response with status 500 Internal Server Error which
may include the error message as a plain text body.This does not explicitly drop any inbound Keep-Alive connections. |
error
|
String |
Indicates the reason why the request handling failed. Present and applicable only if success == 0.
|
rest
|
Object |
Container for the REST HTTP Response parameters we are to send. Present only if success == 1.
|
abandon
|
1
|
Set this to 1 to abandon the inbound HTTP connection without sending any HTTP Response bytes.If this attribute is set then the other HTTP and REST attributes are ignored. (Default is to send HTTP Response, do not abandon the connection) |
code
|
Integer |
The HTTP Response Status Code to send (e.g. 200) (Default for success case = 200) |
content_type
|
String |
The HTTP Request Content-Type header value to send.
|
content
|
String |
The HTTP Request content to send. (Default = None) |
http_headers
|
Array of Objects
|
Additional user-level header objects to apply to an outbound HTTP Response (see below for object structure). These headers are added after any headers defined by static RestServerApp application configuration.You should not set the Content-Type or Content-Length headers.(Default = No Additional Headers) |
Each object in the rest.http_headers Array for REST-S-RESPONSE has the following structure.
| Field | Type | Description |
|---|---|---|
name
|
String
|
[Required] The name of the HTTP Response header. |
value
|
String
|
[Required] The full string value of the HTTP Response header. |
replace
|
0 / 1
|
If 1 then all previous headers of this name are removed, and this header replaces them.(Default = Append to the existing headers, do not replace) |