Blog

- May 31, 2016

You’ve got a great API, and you’d like to easily help people get started with that API, by allowing them to quickly launch their first API call, from anywhere. Hmm… how could you do that? Well, let’s have a look at DHC! You can create a simple link or button in any web page, with some special JavaScript sauce, to let API consumers launch DHC with a pre-filled request.

If you look back at my Pi digits API from a couple months ago, you might have noticed this button:

api-pi-dhc-launch-button-webpage

If DHC isn’t installed in Chrome (as DHC is a Chrome extension), it’ll suggest you to install DHC. But if DHC is indeed installed, it’ll launch DHC with a pre-filled request, that you can directly try to send!

api-pi-dhc-launch-button-request

How to do the magic? You’ll need a bit of pixie dust in your HTML page:

  • a meta tag to make DHC aware of the fact you want to launch a request,
  • a bit of JavaScript to let your page communicate with the DHC Chrome extension,
  • and a JSON payload to represent the details of the request you want to open in DHC.

To learn more about how to open DHC from any web page, with custom requests, you can read some more details on the DHC documentation to get all the technical details.

 

  • Cool, idea!
    Do you plan to add Swagger support?
    It would be great to add “Open in DHC” buttons for all 230+ APIs in my collection: https://APIs.guru

  • Hi,
    yes, we do plan to add Swagger as an input format for the Open in DHC button. Don’t hesitate to share more on what’s your requirements, use-cases. send us an email to support@restlet.com

    Regards,
    Filip