Skip to main content
Version: Streamsheets 2.5

HTTP.RESPOND

star This is a premium feature.

Sends either arbitrary JSON data or a message from the outbox to specified Producer. Usually this function is used to respond to a previously received request-message. You can use the Function Wizard for this function.

Syntax

=HTTP.RESPOND(Consumer, RequestId, Body, [StatusCode], [Headers])

Arguments

NameDescription
ConsumerName of the Consumer to use for sending respond.
RequestIdThe requestId as provided by a previously received request-message
BodyData to send as response.
StatusCode (optional)Defaults to 200. HTTP status code of the response.
Headers (optional)Headers of the response.

Return

TRUE on success or error code otherwise.

Examples

We assume that a request-message was received and that it provides a requestId which we store to cell B1 by using the read function as follows: READ(INBOXMETADATA(,,"requestId"), B1, "String")

FormulaResultComment
=HTTP.RESPOND(|Rest,B1,DICTIONARY(A3:C5))
TRUESends the JSON data provided by the DICTIONARY function to the Consumer named Rest using the requestId in B1
=HTTP.RESPOND(|Rest,B1,"Not Found",404,A2:B2) 
TRUEResponds to the request corresponding to requestId with the body “Not Found”, status code “404” and the header “Content-Type: text/plain”.