Set HTTP Response (script step reference)

Activator Plug-in for FileMaker Pro

Set HTTP Response

Set the (HTML) text which is returned to the remote client in response to the HTTP URL request.

SyntaxScript step badge

Set HTTP Response [ Select ; Result (error) ; Response ; EventID ]

Options

Select entire contentsreplaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error)an error code
Responsethe (HTML) response you want to give back for a request
EventIDthe Activator event ID of the triggered event

Returned Result

Data type returned

Error code

Result

The returned result is always 0 (no error).

Originated in

Activator Plug-in 5.0

Compatibility

FileMaker Pro 16 to 17

Considerations

The response is only returned to the remote client when ‘waitForResponse=yes’ is added to the HTTP URL request, for example like this:

http://www.example.com:54242/triggerscript.html?waitForResponse=yes&yourText=getdatalist

Otherwise a default response will be returned immediately.

You can set the responseText to (simple) HTML code, or to whatever you want. You can also set it to contain other data formats for example XML with text from records of your database. Or set it to just the text “OK” or “ERROR”.

The responseText is sent as UTF-8 encoded.

Example

Set HTTP Response [ Select ; $ErrorCode ; “OK” ; 1234 ]

This command will set the response text to “OK” for the event ID 1234.

Example 2

Add the following script step to your trigger script:

Set Variable [ $ResponseText ; "<html><head><title>Hello</title>" &
                               "<body><h2>Your response</h2></body></html>" ]
Set Variable [ $EventID ; Actr_GetEventInfo ( "-LastTriggered -GetActivatorEventID" ; ) ]
Set HTTP Response [ Select ; $ErrorCode ; $ResponseText ; $EventID  ]

$EventID is set to the eventID of a HTTP request. You should set the variable $ResponseText to contain the (HTML) response you want to give back for this request. Here we set the response to a simple HTML page.

Related script stepScript step badge

Start HTTP Server

Related functionsFunction badge

Actr_SetHTTPResponse
Actr_StartHTTPServer

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 14 to 17 –> Set HTTP Response (actrp7625) 2019-0423 16:25:14