YOUSEFUL / FILEMAKER

Youseful Curl: FAQ, examples and tutorial

Learning center · Function reference

Use YsflCurl.fmx64 for libcurl transfers, HTTP/2 negotiation and detailed transfer information. The parsing examples are offline; the tutorial needs your own read-only test endpoint.

FAQ

Is this the curl command-line program? No. These are FileMaker calculation functions backed by the plug-in's bundled libcurl. Supply the options documented here, such as timeout=15, rather than command-line flags such as --max-time.

Does http2 guarantee an HTTP/2 connection? It requests negotiation. Inspect YsflCu_Info ( "httpversion" ) for the protocol actually used. The server's capabilities determine the outcome.

What units does totaltime use? Seconds. Multiply by 1000 for milliseconds. Capture the value immediately after the transfer you want to measure.

Where is a detailed trace? Supply the verbose option and read YsflCu_Log after the transfer. Traces can contain request details; remove credentials and sensitive headers before sharing them.

Examples

Percent-encode a query value:

filemaker
YsflCu_Escape ( "a b&c" )

Result: a%20b%26c.

Get a URL's default port without connecting:

filemaker
YsflCu_ParseURL ( "https://api.example.com/items" ; "port" )

Result: 443.

Tutorial

Standalone sample scripts: Measure a transfer.

Goal: measure a GET and display its status, negotiated protocol and elapsed time.

  1. Replace the placeholder with a read-only test URL you are allowed to call.
  2. Create Youseful - Measure a transfer:
filemaker
Set Variable [ $url ; Value: "https://api.example.com/demo.json" ]
Set Variable [ $body ; Value: YsflCu_Get ( $url ; "http2 timeout=15 connecttimeout=10" ) ]
Set Variable [ $transportError ; Value: YsflCu_LastError ]
Set Variable [ $transportMessage ; Value: YsflCu_LastErrorText ]
If [ $transportError <> 0 ]
    Show Custom Dialog [ "Transfer failed" ; $transportMessage ]
    Exit Script [ Text Result: $body ]
End If
Set Variable [ $status ; Value: YsflCu_Status ]
Set Variable [ $protocol ; Value: YsflCu_Info ( "httpversion" ) ]
Set Variable [ $seconds ; Value: YsflCu_Info ( "totaltime" ) ]
Set Variable [ $report ; Value:
    "HTTP status: " & $status & "¶Protocol: " & $protocol &
    "¶Elapsed milliseconds: " & Round ( GetAsNumber ( $seconds ) * 1000 ; 1 )
]
If [ $status < 200 or $status >= 300 ]
    Show Custom Dialog [ "Server returned an error" ; $report & "¶" & $body ]
Else
    Show Custom Dialog [ "Transfer complete" ; $report ]
End If
  1. Run it. Expect a status such as 200 and an elapsed time in milliseconds. Protocol and timing depend on the endpoint and network; no fixed timing is promised by this example.

Troubleshooting

LastError is a libcurl transport error, not an HTTP response code. Capture it before calling Status or Info, which clear the error. Use Protocols to see the schemes included in this build; a listed protocol does not imply that every protocol-specific interaction has a dedicated FileMaker API.