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.
Only the options listed below are supported by FileMaker clients. For more information, see the cURL documentation.
Option1 | Parameter2 | Notes |
|
|
|
|
|
|
|
|
|
|
| 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 an integer followed by an optional unit. |
|
|
|
|
| Specify one port or a range of ports. |
|
|
|
|
|
|
|
|
|
|
| Specify a decimal number of seconds. |
|
| By default, keepalive messages are enabled. Use this option to disable. |
|
|
|
|
| The filename is used only as an attribute of container data. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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. |
|
|
|
|
|
|
|
| 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. |
|
|
|
1. For some options, long and short forms of the option name are supported (for example, ‑‑data
and -d
).
2. Optional parts of parameters are in brackets [ ].
3. Direct file access is replaced with a FileMaker variable.
4. Direct file access is replaced with a FileMaker variable prefixed by the @ character.
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.
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(LastExternalErrorDetail) 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(LastExternalErrorDetail) 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").
Sends HTTPS POST data as two key-value pairs, fname=Bob
and lname=Smith
, to www.filemaker.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://www.filemaker.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 [ Verify SSL Certificates ; With dialog: Off ; $$results ;
"https://www.filemaker.com/" ;
"--user myusername:mypassword -d @$post_data" ]
•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\""