Skip to content

Become an API Browser #259

@dschulten

Description

@dschulten

Httpie should enable me to use an API forwards and backwards by following GET links. If I click a link, the current request should be replaced by the new request, inheriting headers of the previous request, executed immediately. The previous requests should be added to a history stack. There should be a Back, Forward and Refresh button. In other words Httpie should become an API browser. I have no idea why everyone follows the weird choice of Postman to open new tabs for every followed link. The thing is, if Httpie did it that way, it would support state transfer and be "restful": the next response becomes the new state of the application (see Fielding's REST dissertation).

Creating a new httpie draft should be a secondary action, the default clicking action should be to follow the link immediately.

Now what could be your unique selling point: If the current request is in a content-type known to contain descriptions about additional HTTP method interactions in addition to GET, together with descriptions of the request body, Httpie should offer to execute these methods.

Examples of such content-types: http://rwcbook.com/hal-forms/, https://github.com/kevinswiber/siren

The obvious thing would be to offer a plugin extension point which:

  1. allows to scan the current response and make actionable parts of the response clickable (e.g. by adding a play button in the gutter).
  2. when the user clicks the button, call the plugin with the current response and the information what was clicked. Let the plugin decide how it wants to be told what was clicked - maybe jsonpath, maybe xpath, maybe some other selection method the plugin can use to find the action description in the response
  3. allow the plugin to show a form to collect data as described by the clicked action, with submit and cancel button. The form ideally should support all standard HTML inputs, so that the plugin can populate it based on the media type's action description. If the form is submitted, pass the collected data to the plugin, let the plugin add a new httpie request to the history from the collected data and execute it. It would be marvellous if the form even supported a concept like https://www.react-hook-form.com/api/usefieldarray/ for nested objects. Httpie should probably control what the form is able to do by offering a form api that allows to add controls one after the other, just stacking the input controls.
  4. Support cache headers including etag and if-modified-since (again, be a browser)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions