A Simple RESTful Service: Difference between revisions
From DataFlex Wiki
Jump to navigationJump to search
m
DataFlex
m (Cat) |
m (DataFlex) |
||
Line 1: | Line 1: | ||
To create a service we will require a WebApp, and within that an object of the [https://docs.dataaccess.com/dataflexhelp/index.htm#t=mergedProjects%2FVDFClassRef%2FcWebHttpHandler.htm&rhsearch=cWebHttphandler&rhsyns=%20&rhhlterm=cWebHttphandler cWebHttpHandler class]. | To create a service we will require a WebApp, and within that an object of the [https://docs.dataaccess.com/dataflexhelp/index.htm#t=mergedProjects%2FVDFClassRef%2FcWebHttpHandler.htm&rhsearch=cWebHttphandler&rhsyns=%20&rhhlterm=cWebHttphandler cWebHttpHandler class]. | ||
The code below shows how you might write a simple RESTful API for the sample Customer table (from the DataFlex Examples: WebOrder or WebOrderMobile, which will, by default, have been installed under "C:\DataFlex ''nn''.''n'' Examples" if you chose to install the Examples during the installation process - it also uses the WebAppUser table from those examples). | The code below shows how you might write a simple RESTful API for the sample Customer table (from the DataFlex Examples: WebOrder or WebOrderMobile, which will, by default, have been installed under "C:\DataFlex ''nn''.''n'' Examples" if you chose to install the Examples during the DataFlex installation process - it also uses the WebAppUser table from those examples). | ||
'''Warning''': This sample code exposes your customer table to the world (or, if using one of the security options below, to anybody who has valid credentials) - they can abuse that as they choose. It is probably not an approach you would want to take in a real-world environment without considerable enhancement! (Details on the [[Talk:A_Simple_RESTful_Service|discussion page]].) | '''Warning''': This sample code exposes your customer table to the world (or, if using one of the security options below, to anybody who has valid credentials) - they can abuse that as they choose. It is probably not an approach you would want to take in a real-world environment without considerable enhancement! (Details on the [[Talk:A_Simple_RESTful_Service|discussion page]].) |