company logo

QUERY POST Request

Because the complexity of OSI POST requests, OHTTP provides a feature of predefined queries, which may be executed as QUERY POST requests:

http://server:port/query/type/class/method?parameters

Mainly, query definitions provide a mapping between application and database terminology. How the mapping will be resolved depends on the request type defined in the query.

The URL for an QUERY POST request only contains the keyword query (not case sensitive), followed by the request type, the class name and the query definition name. Request data is passed in the body of the QUERY POST request. When omitting the class name, the method must be defined as global method.

type - Typically, QUERY requests (request type) are defined as OSI, PUT or PATCH requests. In case of PUT/PATCH requests, values to be assigned are taken from parameters passed to the request, where parameter names correspond to application defined names. For OSI QUERY definitions, one may define hierarchical requests.

class - defines the object type, the query definition refers to. In case of global queries, * has to be passed as class name.

method - The method (query) defines a request body in a formalized way. A query method is defined in global (*) or class context, i.e. class/methode do identify a query.

QUERY definitions are stored in the resource database using a system-defined type HTTP_Query, which also provides a check feature. QUERY definitions may be provided as direct, reference or hierarchical field definitions (HTTP_Field). Direct field definitions are defined for elementary data fields. Complex data type field may either refer to another QUERY definition or to a subordinated field definition list. Query definition resist on server side and are resolved there to corresponding HTTP requests discussed in previous chapters.

Because OSI POST requests allow doing everything manipulating the database content (as GET, PUT, PATCH and DELETE do), QUERY POST request is also a mean of security. By restricting access to QUERY, (allow=QUERY in the server ini-file), only predefined queries may be executed.