Supported cURL options
cURL (Client for URLs) is an open-standard library of software functions that enable the Insert from URL script step to support many common file transfer options. In this script step, use Specify cURL options to create a calculation that includes one or more of the following cURL options.
Note Within cURL options, precede each quotation mark with a backslash. For example, to specify an HTTP header for Content-type: application/json
, the text expression for Specify cURL options is:
"--header \"Content-type: application/json\""
Only the options listed below are supported by FileMaker clients. For more information, see the cURL documentation.
Option1 | Parameter2 | Notes |
---|---|---|
|
|
|
|
|
|
|
|
Specify the client certificate file3 to use with HTTPS, FTPS, or another SSL-based protocol. Append This option assumes a certificate file that has the private key and the client certificate concatenated. Use |
|
|
Specify the type of the client certificate. |
|
|
|
|
|
Specify a decimal number of seconds. |
|
|
Using "-" for current file size is not supported. Data replaces, not appends to, binary targets. |
|
|
See table note 3. |
|
|
Direct file access and "-" are replaced with a FileMaker variable. |
|
|
|
|
|
See table note 4. |
|
|
See table note 4. |
|
|
See table note 4. |
|
|
|
|
|
See table note 4. |
|
|
|
|
|
|
|
|
|
|
|
See table note 3. |
|
|
Specify a decimal number of seconds. |
|
|
|
|
|
When Insert from URL targets a variable, use this option to force returned data to be stored as container data. |
|
|
Converts text in the options that immediately follow this option from the FileMaker internal character encoding to the specified encoding. Use one of the names defined for the |
|
|
See table note 4. |
|
|
|
|
|
|
|
|
|
|
|
Specify one of these methods. |
|
|
|
|
|
Append |
|
|
|
|
|
|
|
|
Also sets |
|
|
Specify one of these modes. |
|
|
|
|
|
|
|
|
Use this option once for each header you specify. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify an integer number of seconds. |
|
|
Specify the type of the private key file. |
|
|
Specify the private key file3. Use this option if you need to provide your private key separately from the certificate file. |
|
|
Specify an integer followed by an optional unit. |
|
|
|
|
|
Specify one port or a range of ports. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify a decimal number of seconds. |
|
|
By default, a compressed response is requested. Use this option to disable. |
|
|
By default, keepalive messages are enabled. Use this option to disable. |
|
|
|
|
|
The filename is used only as an attribute of container data. |
|
|
Passphrase for the private key. Use this option if you need to provide your private key's passphrase separately from the certificate file. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use this option once for each header you specify. |
|
|
Unlike the curl command-line tool, if the password doesn't exist, FileMaker clients don't ask the user for it. |
|
|
|
|
|
|
|
|
Specify the public key file to use with SFTP protocol. Use |
|
|
Use this option once for each command to the FTP server. |
|
|
|
|
|
|
|
|
Supports |
|
|
|
|
|
Use this option once for each resolver you specify. |
|
|
See Handling errors. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify an integer number of bytes per second. |
|
|
Specify an integer number of seconds. |
|
|
|
|
|
|
|
|
Only supports specifying a cURL-style date expression. |
|
|
|
|
|
See table note 3. |
|
|
See table note 3. |
|
|
|
|
|
See table note 3. Does not support globbing (specifying filenames that match a pattern). For FTP and FTPS, the filename after uploading to the server will be the same as the filename specified at the end of the URL. For all other supported protocols, the filename is the same as specified in the container data; any filename in the URL is ignored. |
|
|
|
|
|
Unlike the curl command-line tool, if the password doesn't exist, FileMaker clients don't ask the user for it. |
|
|
|
|
|
Displays information about the version of the cURL library (libcurl). The first line shows the full version of libcurl and other linked third-party libraries. The second line (starting with "Features:") lists supported libcurl features. |
Table notes
-
For some options, long and short forms of the option name are supported (for example,
‑‑data
and-d
). -
Direct file access is replaced with a FileMaker variable prefixed by the @ character.
Using variables
Although none of the supported options allow you to directly access or create files in the file system, you can specify a FileMaker variable as the source or destination of the data that the option requires. To access or create a file, you can set the variable to a container field.
To access a file, you can set the variable to a container field, which contains the file, then use that variable as the parameter of the cURL option.
To create a file, you can use a variable as the parameter of the cURL option, set a container field to that variable, then export the container field as a file.
Handling errors
Unsupported cURL options are ignored.
If you use the --show-error
option:
-
When errors returned by the cURL library cause FileMaker clients to return error code 1631 via the Get(LastError) function to indicate an unspecified connection failure, the Get(LastErrorDetail) function returns the same text that the curl command-line tool returns.
-
When an operation succeeds but the server returns a response code of 400 or higher with the data, FileMaker clients return an appropriate error code. If there is no appropriate FileMaker error code, Get(LastError) returns 1631 and Get(LastErrorDetail) returns the response code in the form "Response code: nnn."
If you don't use the --show-error
option, a server response code of 401 causes Get(LastError) to return FileMaker error code 1627 ("Authentication failed"). All other response codes return FileMaker error code 0 ("No error").
Example
Sends HTTPS POST data as two key-value pairs, fname=Bob
and lname=Smith
, to example.com using the credentials myusername
and mypassword
and stores the requested data in the $$results variable.
In the Insert from URL script step:
-
Set Target to the variable named
$$results
. -
Set Specify URL to
https://example.com/
. -
Set Specify cURL options to one of the following equivalent sets of options:
"--user myusername:mypassword --data fname=Bob&lname=Smith"
"--user myusername:mypassword -d fname=Bob --data-ascii lname=Smith"
"--user myusername:mypassword -d @$post_data"
where the variable
$post_data
is set to key-value pairs as text or set to a container field whose content is a text file containing key-value pairs.
This script shows the above example sending key-value pairs from a file in the post_data
container field.
Set Variable [ $post_data ; table::post_data ]
Insert from URL [ With dialog: Off ; Target: $$results ;
"https://example.com/" ; Verify SSL Certificates ;
cURL options: "--user myusername:mypassword -d @$post_data" ]