Set HTTP Response
Set the (HTML) text which is returned to the remote client in response to the HTTP URL request.
Set HTTP Response [ Select ; Result (error) ; Response ; EventID ]
|Select entire contents||replaces 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|
|Response||the (HTML) response you want to give back for a request|
|EventID||the Activator event ID of the triggered event|
Data type returned
The returned result is always 0 (no error).
Activator Plug-in 5.0
FileMaker Pro 16 to 19
The response is only returned to the remote client when ‘waitForResponse=yes’ is added to the HTTP URL request, for example like this:
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.
Set HTTP Response [ Select ; $ErrorCode ; “OK” ; 1234 ]
This command will set the response text to “OK” for the event ID 1234.
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 step
|Start HTTP Server|