upload (Upload table)

The upload transaction uploads a table from the client machine to the 1010data database servers.

Description

The table uploaded through the upload transaction is added to the 1010data database hierarchy and may be made accessible to other users. There is a 5 MB limit on the size of the input for this transaction. For large tables, it is recommended to use the PowerLoader API.

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:

<table>
A 1010data XML table tree. To see the full XML specification for the table tree, see Table Tree.
<name>
The content of this element is the full path for the table in the 1010data database hierarchy.

<name> may also contain any of the following optional attributes and corresponding valid values:

mode
mode specifies how the system will respond when a table is sent that has the same name as an existing table.
  • mode="replace" will replace the existing table with the new one.
  • mode="noreplace" will return an error and will not save the new table.
  • mode="append" will append the new data to an existing table with the name specified.

If mode is omitted, the default is noreplace.

materialize
The materialize attribute is used to activate some of the more powerful table-creation features in 1010data, such as segmentation.

To activate these features, use materialize="1".

<users>
Contains <user> elements, each containing a UID that is authorized to view the directory or table.

See Users Tree for the XML schema.

XML response from server

A successful upload 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.

Query string example

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

XML input example

<in>
  <table>
      <title>Store Master</title>
      <cols>
          <th name="store_id" type="i">Store ID</th>
          <th name="store" type="i">Store
          Number</th>
          <th name="addr" type="a">Address</th>
          <th name="city" type="a">City</th>
          <th name="state" type="a">State</th>
          <th name="zip" type="a">Zip
          Code</th>
          <th name="sdiv" type="i">Division
          (store)</th>
          <th name="sqft" type="i">Selling Area
          Sq Ft.</th>
          <th name="type" type="a">Location
          Type</th>
      </cols>
      <data>
          <tr>
              <td>1</td>
              <td>2136</td>
              <td>2016 N WAYNE ST.</td>
              <td>ANGOLA</td>
              <td>IN</td>
              <td>46703</td>
              <td>5</td>
              <td>5346</td>
              <td>SHOPPING CENTER</td>
          </tr>
          <tr>
              <td>2</td>
              <td>1894</td>
              <td>N96 W18515 COUNTY LINE ROAD</td>
              <td>MENOMONEE FALLS</td>
              <td>WI</td>
              <td>53051</td>
              <td>6</td>
              <td>7128</td>
              <td>STAND ALONE</td>
          </tr>
          <tr>
              <td>3</td>
              <td>1889</td>
              <td>231 BLUEBELL DR N.W.</td>
              <td>NEW PHILADELPHIA</td>
              <td>OH</td>
              <td>44663</td>
              <td>5</td>
              <td>7789</td>
              <td>STAND ALONE</td>
          </tr>
      </data>
  </table>
  <name mode="noreplace">certification.test_upload_table_api</name>
  <users>
    <user>cp_training1</user>
    <user>cp_training2</user>
  </users>
</in>

XML response example

<out>
    <rc>0</rc>
    <msg>Added table certification.test_upload_table_api</msg>
</out>