Page History
...
- Custom control over the creation of the resource object.
- Ability to include the Key ID within the resource object.
- Ability to identify a part of a Key ID as the resource ID.
- Lower-level errors can be trapped and handled as desired.
- The handle to the JSON object is compatible with the SRP_Json utility function (for even more custom control as needed).
Cons:
- Caller must serialize the JSON object.
- Caller responsible for setting HTTP response elements.
Method 3: Using the SRP_Json Utility Function
GetDatabaseItem is an example of a high-level service. That is, it relies upon a simple interface and default behavior. Like other high-level services, GetDatabaseItem is built on top of slightly lower-level services. The most important one of these is GetObject. (which is also a member of the HTTP_Resource_Services module). Let's look at an example of an API that uses the GetObject service to produce the same resource as the GetDatabaseItem service:
Code Block | ||
---|---|---|
| ||