|
|
|
|
|
- Overview
- Principle for calling a function of a REST web service
- Steps for creating a REST web service
- Creating a REST web service project or project configuration
- Creating a REST web service project
- Creating a REST web service project configuration
- Creating a description of REST web service
- Creating entry points
REST web service: Creating a REST web service
A REST web service is a program hosted on a server. This program contains functionalities accessible via HTTP requests. Each functionality (also called API or entry point) corresponds to a process run on the server. Each entry point is characterized by: - a resource,
- an HTTP method (GET, POST, PUT, etc.).
A REST web service can contain entry points with identical URLs and different HTTP methods (representing a different action). The available HTTP methods are as follows: - GET to get information.
- POST to create.
- PUT to modify.
- DELETE to delete.
- PATCH to modify.
- HEAD to get information.
Principle for calling a function of a REST web service The call to a function of a REST web service is performed via a resource (URL). This resource itself represents the nature of information used as well as their identification. The HTTP methods (verbs) used in the address are used to specify the kind of action to perform. In the function, the HTTP codes (2xx, 3xx, 4xx and 5xx) are used to indicate the status report of REST function. For example, the following address: http://server/Customers/10/Orders represents the following action: "Retrieve the list of orders for customer # 10". In this address: - server represents the address of the server hosting the REST web service.
- Customers indicates that the request will handle data about customers.
- 10 represents the customer's ID.
- Orders indicates that the request will handle data about orders.
This HTTP request is made using the GET method. This means that data is expected in the response. Steps for creating a REST web service Creating a REST web service project or project configuration Creating a REST web service project To create a REST web service project: - Click
in the WINDEV quick access buttons. In the window that appears, click "Project". The project creation wizard opens. - Choose the type of project to create: "SOAP or REST web service". Proceed to the next step of the wizard.
- Choose a REST web service. Go to the next step.
- Specify the project name and location. These options cannot be modified.
All the objects associated with the project will be created in the specified directory. - Finish the wizard. The created project becomes the current project.
Creating a REST web service project configuration To create a REST web service project configuration: - In the "Project explorer" pane, right-click "Configurations" and select "New configuration". The project configuration creation wizard opens.
- Select "SOAP or REST web service" and specify the name and description of the project configuration. Proceed to the next step of the wizard.
- Choose to generate a REST web service. Proceed to the next step of the wizard.
- If necessary, indicate the elements you want to integrate into the project configuration.
- Finish the wizard. A new REST web service description is automatically created, and the entry point creation wizard starts.
Creating a description of REST web service Reminder: A REST web service description can be used to group together functions that serve a common purpose. To create a REST web service description: - In the "Project explorer" pane, right-click "REST web services descriptions" and select "New REST web service description".
- Type the name of the REST web service description and validate.
- The entry point creation wizard automatically opens.
The entry point creation wizard lets you select the creation method:
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|