KeyRoutines
StepProhttp.request

Call a web API from a Windows routine with an HTTP request

HTTP request calls a web API and hands the answer to your routine. It needs KeyRoutines Pro and connects routines to smart home hubs, status pages, to-do services and anything else with a REST API.

KeyRoutines Pro is a one-time $29.99 upgrade for up to 2 PCs.

How it works

  • Enter the address and choose the method; send a JSON, form or text body, and add query values or headers under the advanced options.
  • For sign-in, pick bearer, basic, a header, a query value, or a key inside the address; the token lives in the vault and is only sent to the sites you allowed it for.
  • The step returns the status, the body, the body read as JSON, and any values you name by path, such as data.items[0].id.
  • An error status of 400 or above fails the step but still fills its outputs, so an error branch can read them; you can turn that off and check the status yourself.
  • Redirects are followed a limited number of times, and sign-in headers are dropped if a redirect leads to a different site.

Routines that use it

Smart lights on arrival

When Back at the PC fires in the evening, HTTP request calls your light hub's API to turn the desk lamp on.

Weather in a banner

At a time at 07:30 fetches a weather API and Show banner displays the temperature it returned.

Log to a spreadsheet API

When Game stopped fires, POST the game's name and play time as JSON to your own logging endpoint.

Settings

SettingWhat it does
UrlThe address to call, like https://api.example.com/items.
MethodGET reads. POST sends something new, PUT and PATCH change it, DELETE removes it, HEAD only asks for the headers.
Body typeWhat to send with the request.
BodyThe body. For JSON, put values from earlier steps in with {{ x | json }} so quotes stay valid.
FormForm fields, sent as name=value pairs like a web form.
Sign inHow to sign in. The token comes from the vault and is only sent to the sites it is allowed for.
TokenThe secret to sign in with.
UsernameThe user name; the secret is the password.
Key nameThe header or query name the token goes in. Empty: X-Api-Key for a header, api_key for a query value.
QueryadvancedValues added to the address after ?, escaped for you.
HeadersadvancedExtra headers, like Accept: application/json. Put tokens under Sign in, not here.
Fail on error statusadvancedFail the step when the site answers with an error status (400 and up). Off: the step succeeds and Status says what came back.
KeepadvancedValues to keep from a JSON answer: a name, and the path to it like data.items[0].id. Later steps read {{ steps.<this step>.values.<name> }}.

Good to know

  • Only http and https addresses; replies larger than 8 MB are refused.
  • Cookies aren't kept between requests, so sites that need a browser login won't work this way.

Questions

How do I keep my API key safe in a routine?
Store it in the vault and choose it under Sign in instead of typing it into a header. The token is only filled in for the sites you allowed it for and is hidden in logs.
Can I use part of the JSON reply in later steps?
Yes. Name the values you want by path, like data.items[0].id, and later steps can read them from the step's outputs.
Does a failed request stop the routine?
By default an error status fails the step, but its status and body are still available to an error branch. Turn off 'fail on error status' to always continue and check the status yourself.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.