savefile (Save query results as a file)

The savefile transaction saves the results of a query as a file in your 1010data FTP folder. The file can then be downloaded via FTP.

Note: To use this transaction, you must be authorized for FTP downloads.

Query string

The query string in the HTTP header must contain the following parameters:

Specify the name of the API transaction.
Specify the version of the API that should handle the requested transaction.

For the most up-to-date version, use apiversion=3.

Specify a valid 1010data user name.
Specify a valid password for the 1010data user name provided to the uid parameter.
Note: The pswd value should be the encrypted password returned from the login transaction.
The session ID for the current API session.

This value is returned by the login transaction and must be provided to every transaction (except login).

kill (optional)
Valid values for kill are as follows:
Terminate the existing session and start a new one.
Do not terminate the existing session.

If no session exists, a new one will be created. If a session does exist, an error is returned.

Note: If kill=no and a session is active, the system returns an error.
Log in and possess the existing session.
Authenticate with the system but do not kill, possess, or start any session.

The default is yes.

XML Input to Server

The specifications must contain the following elements:

The name of the result file

If a file already exists with that name, it will be replaced.

The meta information to include in the file (optional)

<content> must contain one or more <meta> elements, each identifying one type of information.

Each <meta> element must include attribute type and type may have one of the following values:
  • headers - Column headers
  • names - Column names

If not specified, no meta information is included in the file.

The data format for the result (optional)
<format> has no attributes and may contain the following elements:
  • <sep> - Character with which to separate fields (columns)
  • <linesep> - Character with which to separate records (rows)

If not specified, the column separator is a comma, and the line separator is newline ( &#10;).

<file> is required; the others are optional.

Query string example$UID&pswd=$PSWD&sid=$SID

XML input example

<file>My File</file>
   <meta type="names"/>

XML response from server

A successful savefile contains the following elements:

The return code generated by the transaction. For a list of return codes, see Return codes.
The message returned by the system. Specific messages correspond to specific return codes.

XML response example

  <msg>Saved file My File</msg>