Make sure, you choose equal action in your insomnia-request-address bar. But if you send data to the API it is POST. Generally, if you request data from the API, the action to use is GET. You can easily create as many requests as needed in Insomnia. The above steps work in same way for all other available API requests that Hetzner provides for its DNS. Regarding the API documentation, search_name shows me up to 100 zones that contain the search word. Enter the name of the key and the value (I used key: search_name with value config).So here is how we add those parameters to our request: We've seen before in the API documentation, that requests can have multiple parameters. Should look similar to the following image: Send request and look for the response.Make sure ADD TO is set to Header (which is default).Click on the tab "Auth" below the address bar and select "API Key".It needs to be sent in the Header of the request. Here we choose _.url and complete the path with the information we got from the API docs before.Īs you might remember, there was a required field for this request. Insomnia now opens a pulldown with all variables you have set before in the environment. In the address bar of Insomnia, make sure you select GET.Double-click on the placeholder "New Request" and give it a name (e.g.Step 3.2 - Create the request in Insomnia The Request samples section shows how a request should look like.But depending on the kind of request, other parameters might also be needed! The API token is required for any request.Here, we see which query parameters are possible, and what values are required.We choose the kind of request in the sidebar navigation.Step 3.1 - Find requirements for the API requestīased on the following image, we can analyze how our request is built: You can use the Base Environment (click on it), and enter 2 variables we will use later on:īased on the API documentation, you can now go on and create requests. Now we add a new Environment in Insomnia: Open your Insomnia application and create a new Request Collection: In the DNS Console on the upper right, click on the user icon and select the menu item API tokens:Ĭhoose a distinctive name for the token and create it:Īfter you've pressed the button, you'll see a popup window that contains your access token. On the upper right, click on the app switcher icon and select DNS. Access to your Hetzner account (to create an API token).(see their official " Install Insomnia" guide). An up and running Insomnia application at your desktop.When I mention "API docs" in this tutorial, I am referring to this one: I use Insomnia on Linux, but it should look pretty similar if you are on MAC or Windows. In this tutorial, I'll show you how to set up and use a REST Client (like Insomnia or Postman) to connect to the Hetzner DNS API. Luckily, Hetzner provides a DNS service, which allows you to use their nameservers (NS) as primary NS or as secondary NS. If you like to automate things in your domain registration process, an API comes in very handy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |