listdir (List the contents of a directory)

The listdir transaction returns a listing of the contents of a directory (folder) and provides more information than the dir transaction, such as user information.

Query string

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

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

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

uid
Specify a valid 1010data user name.
pswd
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.
sid
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:
yes
Terminate the existing session and start a new one.
no
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.
possess
Log in and possess the existing session.
auth
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:

<name>
The full name of a directory. Directory names are specified as a full path to the location of the directory, e.g., directory1.directory2.directory[N].thisdirectory.
<include>
An optional filter to reduce the number of attributes returned in order to reduce transmission size. Contained inside the <include> element is a list of <name> elements that specify the directory information that should be returned by the transaction.
  • <include mode="1"> specifies that data is only returned for parent objects.
  • <include mode="2" specifies that data is returned for parent and child objects in the directory.

See the XML input example for more information.

XML response from server

A successful response from the server contains the following elements:

<rc>
The return code generated by the transaction. For a list of return codes, see Return codes.
<msg>
The message returned by the system. Specific messages correspond to specific return codes.
<dir>
Contains data about parent and/or child objects in a directory.

Query string example

https://www2.1010data.com/gw.k?api=listdir&apiversion=3&uid=$UID&pswd=$PSWD&sid=$SID

XML input example

<in>
    <name>pub.doc</name>
    <include mode="1">
        <name>ldesc</name>
        <name>sdesc</name>
        <name>title</name>
    </include>
</in>

XML response example

A successful listdir produces the following result:

<out>
    <rc>0</rc>
    <msg>listdir successful</msg>
    <dir title="Documentation" sdesc="" ldesc="">
        <parents>
            <dir title="All Databases" sdesc="" ldesc="" />
            <dir title="Published Data" sdesc="" ldesc="" />
        </parents>
        <children>
            <dir title="Government" sdesc="" ldesc="" />
            <dir title="Retail" sdesc="" ldesc="" />
        </children>
    </dir>
</out>