When you define or edit a custom business object in ABCS, the system does two critical things. Firstly, a table is created (or updated) in the ABCS schema. This table persists the data that is managed by the business object. Secondly, ABCS generates a REST API for retrieving and manipulating data. The REST API includes operations for querying, inserting, updating and deleting data. Pages that you create in ABCS make use of this API for performing the requested actions, for example, an Edit form on a Contact object will automatically call the PATCH operation on the Contact REST API.

 

In some cases (primarily for integration with other systems), it may be desirable to invoke the REST API for a business object from outside ABCS. In this blog post, I'll show how you can call the REST API of a custom business object from an external client.

 

Define the Business Object in ABCS

  1. Create a new application.
    • Start by creating a new application. The id of the application will appear in the URL for the REST API. In this example, I name the application HR Application, and provide HRApp as the id.

      1createapp.png

  2. In the page designer, create a business object.
    • Create a business object using either approach of creating it from the page designer (drop a table onto a page), or from the Business Objects tab in the Data Designer. In this case, I've created a business object called Employee and added fields for firstname, lastname, hiredate, and salary.

      2createbusinessobject.png
      Here is how the object looks in the Data Designer:

      3businessobject.png

  3. To simplify example, allow anonymous access to the application.
    • To simplify this example, I've used the Security Settings panel to enable anonymous access to my application and pages.

      4security.png
  4. Publish the app and add data.
    • Stage, then Publish the application. Now, run the published application and add some data. Note the URL for your application.

      5runapp.png

 

Access the REST API

  1. Identify REST URL and call from curl.
  1. API documentation
    • The REST API for the business objects contain descriptive metadata. To access the metadata of the object, you can request the /describe resource of the business object as shown below.

      7describe.png

 

In a later blog post, we will cover aspects of invoking the REST API for a secure service.