If you want to expose methods to allow other systems to delete records in your database, you can do it using a REST API.
Typically, the steps you take are the following:
We have an application to manage contacts and we want to allow other systems to delete existing contacts. We will expose a REST API method that implements this.
This example is a continuation of the example in the previous topic, and we will add the new method to the existing REST API service.
In case you need to create a REST API service, please read Expose Data using REST.
To create the REST API method proceed as follows:
After deploying the application, you have access to the following endpoint:
The HTTP method and the URL is displayed in the properties of the method.
When calling the DeleteContact method, in the URL of the request you need to send the Id of the Contact record you want to update.
We've deployed the application to our environment in the public cloud. To test the method with curl, we use the following command:
curl -X DELETE -D- https://osacademy.outsystemscloud.com/ContactsAPI/rest/Contacts/DeleteContact?ContactId=2
The result is a response with status code 200.
Expose Data Using REST