HowTo: Delete data from a BC exposed as a Rest service

Official Content
This documentation is valid for:

This document explains how to delete data using a Business Component exposed as Rest web services in GeneXus.

First, let's see the basic guidelines:

1. How is the Rest service called in GeneXus?

Use the HttpClient data type.

2. What are the HTTP methods used to delete data?

Delete the data using the HTTP DELETE verb. The PK values have to be added to the query string when the HTTP DELETE verb is executed.


Suppose you want to delete an Invoice record (which is a two-level transaction). Note that the BC is exposed as a Rest Service.


Here, the Invoice whose InvoiceId=1 will be deleted.

Sample Code

&httpclient.Host= &server
&httpclient.Port = &port
&httpclient.BaseUrl = &urlbase

if &httpclient.StatusCode = 200
    &result = &httpclient.ToString()
   msg("There was an error deleting the data: " + &httpclient.StatusCode.ToString())

Download the sample from Sample Delete Rest BC


  • If more than one parameter should be passed in the URL (a compound PK), they need to be separated by commas.
  • If the URI service is http://localhost/TestRESTFullGX.NetEnvironment/rest/Product, the BASE URL is: /TestRESTFullGX.NetEnvironment/rest/
  • Error handling is managed by querying the HTTP Status Code after the invocation.

See Also

Business Components as Rest web services in GeneXus

Note: GeneXus provides the OpenAPI import tool for consuming a Rest service, whether it's been generated by GeneXus or not.