API object - ListCustomers service definition and declaration

Official Content
This documentation is valid for:

This article describes all the necessary steps to define an API object (called APICustomers) and declare inside it a ListCustomers service that returns all the Customer data.

Consider a Knowledge Base containing:

1) A Customer Transaction object:


Note: The Customer Transaction has Automatic data population.

2) An SDT that is a collection with the same structure as the Customer Transaction:

sdt Customers image example

3) A Data Provider object with the logic needed to return all the customer's data:

Data Provider CustomerList example

Note that the Data Provider has the previously defined SDT as the output parameter.

Create an API object called APICustomers. Inside its Service Source tab, you have to declare, for each service, a mapping between its external name (exposed as a service) and the internal implementation in the KB (in this example, the CustomerList Data Provider). Look at the following mapping:

    ListCustomers(out:&SDTCustomers) => CustomerList(&SDTCustomers);

The external service name is ListCustomers; internally, it is solved with the CustomerList Data Provider.

The service source is not allowed to access data. Therefore, you have to use a Data Provider or a Procedure object instead of a For Each command or Business Component.

You could define the following events in the Events tabs, if necessary:

Event Before
    //Some Code if is needed

Event After
    //Some Code if is needed

Event ListCustomers.Before
    //Some code if is needed

Event ListCustomers.After
    //Some Code if is needed

The events execution order would be as follows:

  1. Event 'Before'
  2. Event 'ListCustomers.Before'
  3. ListCustomers method (CustomerList Data Provider)
  4. Event 'ListCustomers.After'
  5. Event 'After' 

You can see all the steps being executed: