Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Resources that are not based on data in a table can still use some of the principles presented below, but there will need to be a little more effort. We will provide additional articles demonstrating how non-database resources can be created.

Table of Contents

The Resource Object

We've already explained that a resource can be represented in any digital format, but the conventional format used by RESTful APIs is to use JSON. In our documentation we will often make reference to the resource object, which is short-hand for the "resource as represented by a serialized JSON object". Please note that at times we will also use the term resource as a synonym for resource object, even though a resource can mean much more than that.

...

In many ways, GetObject and GetDatabaseItem are the same and share some of the same arguments. GetObects differs GetObect differs from GetDatabaseItem in the following ways:

...

Since GetObject only returns a handle to the JSON object, it is the responsibility of the calling process to serialize the resource and update the HTTP response (e.g., Body, Content-Type Header, Status Code, etc.). The reason developers might choose to work with the GetObject service instead of the GetDatabaseItem service (aside from the latter being deprecated) is because developers might require a little more control and ability to customize the resource object. For this reason, developers have access to several other useful services (aka companion services) such as AddProperty, AddSubProperty, AddSubResource, AddLInkRelationship AddLInkRelation, AddEmbeddedResources, and AddFormAction.

...

  • Caller must serialize the JSON object.
  • Caller responsible for setting HTTP response elements.

There is also a GetObjects service. This is a wrapper around the GetObject service. It provides the developer with a Filter argument so multiple rows from a database table can be selected and thus converted into object handles. These object handles are returned as an @FM delimited list to the calling routine. Look at the final code sample in the How do I add a sub-resource to a resource? article to see how useful this can be.

Method 3: Using the SRP_Json Utility Function

...