Date: Thu, 28 Mar 2024 20:10:42 +0000 (UTC) Message-ID: <711764337.10771.1711656642113@911f0a1bad02> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10770_1005024259.1711656642112" ------=_Part_10770_1005024259.1711656642112 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Using the RESTful Web Service plugin business logic can be exposed as a = RESTful Web Service. The RESTful Web Service plugin does not contain any cl= ient side functions or properties, it is a 100% server side operating plugi= n.
=20To create a RESTful Web Service, create a form in a solution and add one= or more of the following methods to the form:
=20In case the matching method for the specific HTTP operation (GET, POST, = DELETE or PUT) does not exists on the form, an INTERNAL_SERVER_ERROR respon= se (HTTP 500) will be generated.
=20RESTful Web Services are to be stateless. As subsequent requests to the = RESTful Web Service API might be handled by different headless clients in t= he pool of clients configured for the plugin, do not use any state in betwe= en calls to the API. This means at least the following:
=20For the POST and PUT operation (resp. ws_create() and ws_update() method= s), data has to be supplied in the body of the HTTP Request. If the content= in the body of the HTTP Request is missing, a NO_CONTENT response will be = generates (HTTP 204).
=20The supported Content-Types are JSON (application/json) and XML (applica= tion/xml). The Content-Type can be explicitly set in the header of the HTTP= Request:
=20Content-Ty= pe: application/json; charset=3Dutf-8=20
Content-Ty= pe: application/xml; charset=3Dutf-8=20
Note: the charset is optional. If not specified, utf-8 will be assumed.<= /p>=20
If no valid Content-Type is set, the plugin will try to establish the ty= pe of the content based on the first character of the content:
=20By default, the response will be encoded with the UTF-8 charset. If the HTT= P Request specified a different encoding, that will be used instead. If the= encoding of the response needs to be different than the request encoding, = this can be specified in the HTTP Request by setting the charset value in t= he Accept header:=20
h4.Authentication/Authorisation The RESTful Web service plugin can be configured to check authentication/au= thorisation. The plugins server property rest_ws_plugin_authorized_groups can be set wit= h a comma separated list of groups defined in the built-in security system = of Servoy. When the property is filled with usergroups, HTTP Basic authentication is e= nabled for all webservice requests. The username/password supplied in the H= TTP Request is validated against the users registered in Servoy's built-in = security system and additionally against group membership. Access is denied= if the user does not exists or the supplied password is incorrect, or the = user doesn't belong to one of the specified groups. When access is denied, an UNAUTHORIZED response is generated (HTTP 401). h4.JSONP support The plugin supports so-called JSONP: a variation of JSON that allows cross = domain data retrieval. The JSONP variation can be invoked by added a "callb= ack" parameter to the HTTP Request URL:=20
When invoked with the value "myCallback" for the "callback" parameter, the = returned JSON value will be wrapped in a function call to the "myCallback" = function:=20
When there are more concurrent requests than the number of clients in th= e pool, by default the requests will wait until a client becomes available = in the pool. This behavior can be altered by setting the "rest_ws_plugin_cl= ient_pool_exhausted_action" property of the plugin. The following values ar= e supported for this property:
=20Servoy Cluster
The RESTful Web service plugin uses a pool of headless clients to servic= e the requests. When operated within a Servoy Cluster, note that poolsize i= s set per Servoy Application Server.
A sample solution is included in the Servoy distribution (servoy_sample_= rest_ws.servoy), detailing how to retrieve data from the http request and t= o return a response.
=20http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.infoq.com=
/articles/rest-introduction
http://www.ibm.com/developerworks/we=
bservices/library/ws-restful/
http://home.ccil.org/~cowan/restws.pdf
{column:padding=3D0px|width=3D80px}{column}{column}{column}
=20Server Property Summery
{column:padding=3D0px|width=3D100%}{column}
=20Server Property Details
Only authenticated users in the listed groups (comma-separated) have acc= ess, when left empty unauthorised access is allowed
The following values are supported for this property:
block (default=
): requests will wait untill a client becomes available
fail: the reque=
st will fail. The API will generate a SERVICE_UNAVAILABLE response (HTTP 50=
3)
grow: allows the pool to temporarily grow, by starting additional cl=
ients. These will be automatically removed when not required anymore.
Max number of clients used (this defines the number of concurrent reques= ts and licences used), default =3D 5