DARRT Project: Transitions

Learn about the role of transitions in the DARRT framework.

We'll cover the following

Transitions in the DARRT framework

The last letter in our DARRT framework stands for transitions. The transitions.js file holds a set of declarations for forms and links related to the API. An example of a link transition in HTML is the anchor (<a>)tag:

<a href="/list/" rel="collection list company">Company List</a>

An example of a form transition in HTML is the form tag:

<form action="/filter/" method="get">
   <input name="search" value="" />
   <input type="submit" />
</form>

HTML format has lots of transition elements—elements that describe a way to transition from one view to the next. Several API formats support link and form transitions too. We discussed the role HTML plays in the common practice of the web. Because one of our goals in creating APIs is to learn from and emulate features of the web, the DARRT framework was designed to allow developers to declare and use transitions in API responses.

Just as in HTML, adding transitions to API responses informs the API caller of the next possible actions in the API workflow. Like HTML, well-designed APIs don’t have just one possible fixed sequence of actions. Instead, users (people for HTML, machines for APIs) can make their own choices on what steps to take next.

The following is what a transition looks like in the transitions.js file of the DARRT framework (it’s similar to the HTML anchor tag we saw earlier):

Get hands-on with 1200+ tech skills courses.