• Docs
  • Home

›HTTP Endpoints

Messages

  • Set Property Fixed
  • Delete Message Property
  • Move Property
  • Map Range

Data Formats

  • Convert to/from JSON
  • Convert to/from XML
  • Convert to/from YAML
  • Generate CSV output
  • Parse CSV input
  • Simple GET request
  • Split text

Flow Control

  • Trigger On Start
  • Trigger At Interval
  • Trigger At Time
  • Route On Property
  • Route On Context
  • Operate On Array
  • Trigger Timeout
  • Trigger Placeholder
  • Rate Limit Messages
  • Rate Limit Message Stream
  • Report By Exception
  • Join Streams

Error handling

  • Retry On Error
  • Trigger On Error

HTTP Endpoints

  • Create Endpoint
  • Handle Query Parameters
  • Handle Url Parameters
  • Access Headers
  • Serve JSON
  • Serve Local File
  • Post Data
  • Post Form Data
  • Post JSON
  • Cookies

HTTP Requests

  • GET Request
  • Set URL
  • Set URL using Template
  • Set Query String
  • Parse JSON
  • Binary Response
  • Set Request Header

MQTT

  • MQTT broker
  • Publish Message
  • Set the topic
  • Publish Retained Message
  • Subscribe to a topic
  • Receive a parsed JSON message

OData

  • Define a Metadata Model
  • Define Metadata Model using EDM
  • Convert Request to Query
  • Read Only OData Service
  • Create an OData Service

Sequelize

  • Execute a Query

Auth

  • Basic Authentication
  • Generate JWT
  • Verify JWT

JSONata

  • JSONata Node
  • JSONata Explorer

Breakpoint

  • Introduction
  • How to Use

OpenAPI

  • Introduction
  • OpenAPI Router
  • OpenAPI Client

Release Management

  • Upload Download Release Management

Designer

  • Designer

Monitor

  • Introduction
  • How To Use

CI/CD

  • Introduction
  • Installation

Create an HTTP Endpoint

Problem

You want to create an HTTP endpoint that responds to GET requests with some static content, such as an HTML page or CSS stylesheet.

Solution

Use the HTTP In node to listen for requests, a Template node to include the static content, and an HTTP Response node to reply to the request.

Example

Flow JSON

[{"id":"59ff2a1.fa600d4","type":"http in","z":"3045204d.cfbae","name":"","url":"/hello","method":"get","swaggerDoc":"","x":100,"y":80,"wires":[["54c1e70d.ab3e18"]]},{"id":"54c1e70d.ab3e18","type":"template","z":"3045204d.cfbae","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        <h1>Hello World!</h1>\n    </body>\n</html>","x":250,"y":80,"wires":[["266c286f.d993d8"]]},{"id":"266c286f.d993d8","type":"http response","z":"3045204d.cfbae","name":"","x":390,"y":80,"wires":[]}]
[~]$ curl https://app_name.herokuapp.com/hello

    
    
        

Hello World!

Discussion

The HTTP In and HTTP Response pair of nodes are the starting point for all HTTP endpoints you create.

Any flow that starts with an HTTP In node must have a path to an HTTP Response node otherwise requests will eventually timeout.

The HTTP Response node uses the payload property of messages it receives as the body of the response. Other properties can be used to further customize the response - they are covered in other recipes.

The Template node provides a convenient way to embed a body of content into a flow. It may be desirable to maintain such static content outside of the flow.

If you have turned on http authentication then you may need add your userid and password to the curl command. e.g.

[~]$ curl -u userid:password  https://app_name.herokuapp.com/hello 
← Trigger On ErrorHandle Query Parameters →
  • Problem
  • Solution
  • Example
  • Discussion
Copyright © 2021 Cyber Group