|
|
|
|
|
- Overview
- Calling a REST web service function
- 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 REST web service description
- 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 a new element (e.g., a new product).
- PUT to modify an existing element. .
- DELETE to delete an element (e.g., a product).
- PATCH to partially modify an element.
- HEAD to get information about an element (e.g., determine if it exists).
Calling a REST web service function You can call a REST web service function using a resource (identified by a URL). This resource contains the type of information manipulated and its identification. The HTTP methods (verbs) used in the address define the action to be performed on the resource. In the function, the HTTP codes (2xx, 3xx, 4xx and 5xx) indicate the response of the 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 new project is opened in the editor.
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 REST web service description 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…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|