High-level framework and low-level REST APIs

REST Web services implemented with the high-level framework outweigh a low-level solution in terms of ease of creation. Yet make sure you are aware of the differences, and when one or other is preferred, or both are needed.

REST high level

Web services implemented with the high-level REST framework use the Function attributes feature to define details of the Web service. Function attributes are specified in an ATTRIBUTES() clause of the function to define operation type, and path. Attributes also define parameters for path template, query strings, return values, etc., of your RESTful Web service function. These special attributes for REST high-level define the framework for creating REST web services.

Web service function attributes are identified with the WS* prefix. For example, the sample function add, is defined on the server side using the attributes, WSGET, WSQuery, WSPath, and WSDescription.
# Query sample
  ATTRIBUTES (WSGET, WSPath='/add', WSDescription='Simple query sample')
  RETURN a + b

When you need to determine what functions are available on the server, you can use the fglrestful tool (server side), to get all of the information necessary in an OpenAPI specification file (JSON or YAML). The fglrestful tool can also generate code automatically for the client.

REST low-level APIs

The standard HTTP classes HTTPRequest, HTTPResponse, and HTTPServiceRequest are available if you need to code individual commands. Be aware that you have to write all the HTTP code of your services by hand.

The client stub generated by the fglrestful tool implements low-level APIs.