Child pages
  • RESTful Web Services

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: sub-section:description edited
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
{sub-section:description|text=}The REST API is accessible through the url: http://domain:port/servoy-service/rest_ws/solutionName/formName
The form needs to haveUsing the RESTful Web Service plugin business logic can be exposed as a RESTful Web Service.

To create a RESTful Web Service, all that is needed is to create a form in a solution and add the following methods to the form:
GET:- ws_read() POST:for the GET operation
- ws_create()
DELETE: for the POST operation
- ws_delete()
PUT: for the DELETE operation
- ws_update()  for the PUT operation

The REST API is accessible through the url: http://domain:port/servoy-service/rest_ws/solutionName/formName

A sample solution is included in the Servoy distribution (servoy_sample_rest_ws.servoy), detailing how to retrieve data from the http request and to return a response.

{note:title=RESTful Web Services & [Servoy Cluster]}Be aware of the ....{note}{sub-section}\\{table:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Server Property Summary{th}{tr}{tbody}{tr}{td}{td}{td}[#rest_ws_plugin_client_pool_exhausted_action]
{td}{tr}{tbody}{tbody}{tr}{td}{td}{td}[#rest_ws_plugin_client_pool_size]
{td}{tr}{tbody}{table}\\{table:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Server Property Details{th}{tr}{tbody:id=420C89DC-38E1-4B81-8126-9F53F84B74E5}{tr:id=name}{td}h6.rest_ws_plugin_client_pool_exhausted_action{td}{tr}{tr:id=des}{td}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_des|text=|trigger=button}{sub-section}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_des|trigger=none|class=sIndent}Action when no more clients are availiable (block/fail/grow), default = block{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=ret}{td}*Returns*\\{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_ret|text=|trigger=button}{sub-section}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_ret|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_see|text=|trigger=button}{sub-section}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_see|text=|trigger=button}{sub-section}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=sam}{td}*Sample*\\{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_sam|text=|trigger=button}{sub-section}{sub-section:420C89DC-38E1-4B81-8126-9F53F84B74E5_sam|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=4059D6A1-372F-4C41-BEA9-3870E51A198A}{tr:id=name}{td}h6.rest_ws_plugin_client_pool_size{td}{tr}{tr:id=des}{td}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_des|text=|trigger=button}{sub-section}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_des|trigger=none|class=sIndent}Max number of clients used (this defines the number of concurrent requests and licences used), default = 5{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=ret}{td}*Returns*\\{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_ret|text=|trigger=button}{sub-section}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_ret|trigger=none|class=sIndent}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_see|text=|trigger=button}{sub-section}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_see|text=|trigger=button}{sub-section}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=sam}{td}*Sample*\\{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_sam|text=|trigger=button}{sub-section}{sub-section:4059D6A1-372F-4C41-BEA9-3870E51A198A_sam|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}