HTTP Shortcuts for Android - what is wrong?

Here’s a way to figure out the URL for any API call:

  • Open the services dev tab (icon at bottom of sidebar that looks like a remote control)
  • Hit F12 in your browser (or whatever turns on developer tools for your browser). Switch to the network tab of your browser’s developer tools.
  • Pick the service you want a URL for and enter the appropriate service data
    (it’ll be in JSON format. A typical value is {“entity_id”:“switch.switchname”}
  • Press the “call service” button and watch for an entry to appear in your network tool below. In Chrome, if I click on the entry, it’ll display the full URL

In practice, you’ll need to remember a few things:

  • You’ll need to append (assuming you’ve set one up) the API password to that URL, so it’ll look like what’s in @Jojojo’s example: http://your_server/api/services/light/turn_on?api_password=your_passwd
  • You need to format this as a POST (URLs that you put in your address bar are GETs). Postman is a good tool for testing POSTs
  • The service data (that JSON code) gets passed as the body or data for your call. If you’re using IFTT with a service that doesn’t require data (like calling a scene directly rather than using scene.turn_on), you may need to pass empty JSON like: {}
3 Likes