You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Application service module that provides simple CRUD operations for resources that map directly to database tables.

Syntax

Response = HTTP_Resource_Services(Service, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)

Returns

The meaning of the response value depends on the service.

Parameters

ParameterDescription
ServiceThe name of the service being requested. Required.
Param1 - Param10Generic parameters.

Remarks 

The SRP HTTP Framework supports two popular JSON friendly data formats: HAL and Schema. HAL stands for Hypermedia Application Language and is an emerging format that implements the HATEOAS constraint of REST. There are other formats that are also emerging and none hold dominance at this point. Likewise, JSON itself stands alongside XML as a widely accepted general purpose format for representing resources. Therefore, if you need or prefer to use another format then you are welcome to extend HTTP_JSON_Services (in case you want to use a different hypermedia format, such as Collection) or write a new service such as HTTP_XML_Services (in case you want to use a different data format, such as XML).

Schema is a meta-data format. It is used to notify clients what kind of data is available, which is handy when user interfaces need to be dynamically built. Schema can be used to define if a prompt is text, numeric, date, combobox, Boolean, etc. Like HAL, Schema is also an emerging format. There are others that may be better suited to your needs.

Services

ServiceDescription
GetDatabaseItem

Usage:
HTTP_Resource_Services('GetDatabaseItem', TableName, SelfURL, ItemID, ColumnNames, ItemArrayLabel)

Comments:
Gets the resource item from a database table. The format will be HAL+JSON.

Returns:
A database row in HAL+JSON format.

GetDatabaseItems

Usage:
HTTP_Resource_Services('GetDatabaseItems', Filter, TableName, SelfURL, ColumnNames, ItemArrayLabel)

Comments:
Gets the resource items from a database table. The format will be HAL+JSON.

Returns:
Database rows in HAL+JSON format.

DeleteDatabaseItem

Usage:
HTTP_Resource_Services('DeleteDatabaseItem', TableName, ItemID)

Comments:
Deletes the resource item from a database table.

Returns:
N/A

PostDatabaseItem

Usage:
HTTP_Resource_Services('PostDatabaseItem', TableName, SelfURL, ItemID)

Comments:
Creates a new or updates a specific resource item in the database table. If a specific resource item is being updated then only the data columns specified will be updated. A PUT will replace the entire resource item.

Returns:
N/A

GetColumnNames

Usage:
HTTP_Resource_Services('GetColumnNames', TableName, ColumnNames)

Comments:
Gets the column names from the dictionary of the table provided that will be used to create the resource. If the ColumnNames argument is used then this service will validate the list as valid columns. In either case, the following rules will be applied:

  • Regardless of the case used to in the ColumnNames argument it will be upper cased to match against the dictionary names correctly.
  • All column names will be returned in lower case.
  • All column names bound to a Key ID of part 0 (i.e., the entire key) will be removed.
  • All non-master column names will be removed to avoid duplicates.
  • SRP FrameWorks audit column names (MODIFIED_BY, MODIFIED_DATE, and MODIFIED_TIME) will be removed.

Returns:
An @FM delimited list of database column names.

GetColumnValues

Usage:
HTTP_Resource_Services('GetColumnValues', TableName, ColumnNames, ItemID)

Comments:
Gets the column values from the database row from the provided table and ID that will be used to create the resource. This is returned as an @FM delimited list of values.

Returns:
An @FM delimited list of database column values for a specific Key ID.

Param1 - Param10

The proper use of the generic arguments are defined in the definition of each service above.

  • No labels