Skip to main content

Actr_SetHTTPResponse (function reference)

By January 1, 2024January 25th, 2024Online Help, Troi Activator Plug-in
Activator Plug-in > Functions reference > Actr_SetHTTPResponse
Activator Plug-in for FileMaker Pro

Actr_SetHTTPResponse

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

SyntaxFunction badge

Actr_SetHTTPResponse( switches ; responseText ; eventID )

Parameters

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

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 17 to 2023

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 Field [ result ; Actr_SetHTTPResponse ("-unused"; "OK"  ; 1234) ]

This command will set the response to “OK” for the eventID 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 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.

Used in example file

HTTPResponse.fmp12

Related functionFunction badge

Actr_StartHTTPServer

Related script stepsScript step badge

Set HTTP Response
Start HTTP Server

Related topics

Activator Plug-in online help (overview)


Online Help Page for Activator Plug-in for 17 to 2023 –> Actr_SetHTTPResponse (actrp4625) 2024-0125 14:51:35