Set the (HTML) text which is returned to the remote client in response to the HTTP URL request.
Actr_SetHTTPResponse( switches ; responseText ; eventID )
|switches||not used, reserved for future use. Leave blank or put "-Unused"|
|responseText||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 14 to 17
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 Field [ result ; Actr_SetHTTPResponse ("-unused"; "OK" ; 1234) ]
This command will set the response to “OK” for the eventID 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 Variable [ $ErrorCode ; Actr_SetHTTPResponse ( "-Unused" ; $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 steps
|Set HTTP Response|
|Start HTTP Server|