Skip to content

restaf Background

devakumaraswamy edited this page Feb 24, 2020 · 1 revision

Background

restAF reduces the hypermedia returned from the REST API calls to a form that is suitable for rapid application development.

REST API response is an hypermedia. In practical terms a hypermedia has the following:

  • Links to

    • What you can do to with this resource

    • Where you can go next

      • Examples: Get a list of items, create a new resource etc...
      • Optionally information(links) on paginating through the data
  • Data

    • A collection of items
    • String
    • arrays, objects etc...
      • Optionally links to operate on the returned data( delete, copy, etc...)

restAF stores all the response and returns an object referred to as rafObject*. The application will use this object to retrieve information from it use as it sees fit. The methods correspond to the various component parts of the response discussed above.

Links

A link has several key parts:

  1. A URI for the next step (edit, delete, and so on).
  2. An identification of the link to indicate what this next step is. This is referred to as rel – short for “link relationship.” You can discern the purpose of that link based on the rel. Some examples are:
  • If the rel is “content,” you will guess that that this end point returns the content.
  • If the rel is “execute,” you will guess that this end point is associated with some type of execution that is appropriate for that context.
  • If the rel is “create,” you will rightly assume that the call will result in something being created.
  1. Media Types
    • The media type used for the payload if the end point needs a payload.
    • The media type of the returned data. This information can be used by applications to determine programmatically how to deal with the data either for processing or display.

The links are reduced to an object called rafLink. You will use rel to locate a rafLink in the rafObject. The primary use of rafLink is as a parameter to the api calls to the server.

Items

Items are the data. Items can be a collection of items, a text string, an array, SVG, and so on. Some examples are as follows:

  • A collection of items: Each item has some data and links to indicate what you can do with this item (delete for example).
  • A string (examples: SVG, status of a job, and so on).
  • An array (example: SAS logs).
  • Some object.
  • And, in some cases, no data only http return codes.

restAF manages the links and data for the application.

Clone this wiki locally