Creating A Service Endpoint
Description
Create a Service Endpoint in Alpha Anywhere to Retrieve, Create, Update and Delete data.
Discussion
It is possible to use A5W pages to define an endpoint that is consumed as a service, using JSON, XML, CSV text or whatever other data format is convenient. In addition to HTTP 'GET', an A5W page can also accept 'POST' requests
A Service Endpoint can be useful for pushing data to an Alpha Anywhere server from another process on the same machine, or another machine on the network.
Security on a Service Endpoint needs to be implemented at the page level.
- Name
- Description
- Get Records
Lets start with a simple page that just returns the records in Northwind Customer Table as JSON data.
- Adding Parameters
In this example, we add a Parameter to the Service Endpoint Page.
- Limit the Data Returned
Add an optional parameter to the page for 'primarykey' so we can limit data returned to a single record.
- Populate Backend Database
This Section demonstrates adding Post Method to Populate the Tables with new records.
- Adding Update and Delete
Now we have a service endpoint that allows us to List, Create , Update and Delete Records from both a Customers and Products Tables.
- Securing The Endpoint
There are a couple options on how to write code to secure the Service Endpoint Page