Plugin: HTTP

This plugin provides a reactive http client integration. Using entities of type http requests via HTTP can be made.

With this plugin it's possible to integrate external services into your home automation.

Entity Types

NamePropertyData TypeSocket Type
httpurlstringinput
methodstringinput
request_headersobjectinput
payloadobjectinput
response_headersobjectoutput
resultobjectoutput
statusnumberoutput

| | jsonrpc | url | string | input | | | jsonrpc_version | string | input | | | method | string | none | | | params | object | input | | | result | object | output | | | error | object | output |

Platform Compatibility

PlatformCompatibility
Linux
MacOS
Windows

Repository

Usage

Usage

GraphQL

Create HTTP Request

First create an entity instance of type http and specify the URL and the method.

How to execute the HTTP Request

By creating the entity instance no request will be made. The next example explains how to execute the request.

mutation {
  instances {
    entities {
      create(
        type: "http",
        id: "a3370278-b05c-4d1a-ad57-cabd575c37e4",
        properties: [
          {
            name: "url",
            value: "https://api.sunrise-sunset.org/json?lat=47.557400&lng=9.707209&formatted=0"
          },
          {
            name: "method",
            value: "GET"
          },
          {
            name: "request_headers",
            value: {}
          },
          {
            name: "payload",
            value: {}
          },
          {
            name: "response_headers",
            value: {}
          },
          {
            name: "result",
            value: {}
          },
          {
            name: "status",
            value: 500
          }
        ]
      ) {
        id
        type {
          name
        }
        properties(
          names: [
            "url",
            "method",
            "request_headers",
            "payload",
            "response_headers",
            "result",
            "status"
          ]
        ) {
          name
          value
        }
      }
    }
  }
}

Execute HTTP Request

By triggering the property payload the HTTP request will be executed and the results will be written into the property result.

mutation {
  instances {
    entities {
      update(
        id: "a3370278-b05c-4d1a-ad57-cabd575c37e4",
        properties: [
          {
            name: "payload",
            value: {}
          }
        ]
      ) {
        id
        type {
          name
        }
        properties(
          names: [
            "url",
            "method",
            "request_headers",
            "payload",
            "response_headers",
            "result",
            "status"
          ]
        ) {
          name
          value
        }
      }
    }
  }
}