Tuesday, February 14, 2017

Creating a Service Code Service Endpoint in Appery.IO

Appery.IO has a neat visual interface to create a REST API service (endpoint). There are two options for creating  a service. In the first option you can generate REST API automatically for a database table or a Custom REST API. In the former, you will be asked for a connection to a table. At present it appears that connecting to a named instance of SQL Server table is not possible.

In the following post, I describe creating a service endpoint using server side code for a Collection(similar to a table). The same interface can be used for creating service flow with advanced logic to include REST API, SOAP Services, Custom SQL Queries, etc. 

API Express create new project FFD


Note: I am not sure why there is a textbox below the Create New Project button as the following screen asks for the name of a New Project.

In the New project window enter the name.


New project is created. Click on SQLData in the project page to open the SQLData page as shown.


Click new service in the screen above.

The New service page opens as shown.


Provide a Group name (JanSvc2_14) and choose Custom REST API and click create.


Drag and drop the Server Code (SC) from the PALETTE to the empty box as shown. If you want to remove it you click the red circle with x.


In the PROPERTIES -SERVER CODE click the handle and select the only script there -loadGoodsScript. For the Script Query Parameters click on the handle to reveal the following:


Choose BODY.

For SCRIPT BODY place check mark for Use previous component and click Generate.


Click Generate. Generate Service Response window opens.


Click Run Server Code API.
The code is run and the result is displayed as shown.


Click Import Response.

The Response is now in the visual designer.


Now you can test the API. Click TEST in the menu. The Service Test page is opened displaying the endpoint and a Test button as shown.


Click Test.
The Test succeeds otherwise there would be an error which you can debug by going to the Settings.


Copy the endpoint in the above and paste it to the address of a browser and you should see this.

Now you have a endpoint to work with.

Hands-on Learning Event in Honolulu 1 : Introduction to Structured Query Language

Database skills are essential in whatever organization and in whatever position and it is crucial that you have this in your arsenal (...