Plum Fuse

API: Downloading Table Data as a CSV

This API request is initiated with an GET to the following URL:

http://quickfuseapps.com/api/1/sdb/download/csv/<tablekey>

Replace <tablekey> with the table to be downloaded. For more information on this parameter, see the Parameters section.

Example usage

Basic example: Downloads all data from the table customers owned by the user.

$ curl -u 'username:password' 
  'http://quickfuseapps.com/api/1/sdb/download/csv/username:customers'

This example returns a CSV document.

Parameters

Required

  • <tablekey> (string) - Identifies the table to be downloaded. This is in the format <tableowner>:<tablename>. It is case and whitespace sensitive. <tableowner> is the full username of the owner of the table. Valid table names contain only letters, numbers, and the underscore _ character.

CSV Format Specification

There is little consensus over what constitutes a valid CSV since the format was used informally long before it was formally specified in 2005; therefore, the following is a description of the CSV format that our webservices understand. As much as possible, we've followed the Basic Rules that most CSV parsers implement, which is also the format that Microsoft Excel exports and imports most easily.

  1. Each record is one line terminated by a line feed (ASCII/LF=0x0A) or a carriage return and line feed pair (ASCII/CRLF=0x0D 0x0A), however, line breaks can also be embedded in values as described in rule 5.
  2. Fields are separated by commas or tabs. If we discover a tab character in the first line of your CSV, we will use the tab character as a delimiter instead of the comma.
  3. Fields with embedded delimiter characters (whether comma or tab) must be enclosed within double-quote characters.
  4. Fields with embedded double-quote characters must be enclosed within double-quote characters, and each of the embedded double-quote characters must be represented by a pair of double-quote characters.
  5. Fields with embedded line breaks must be enclosed within double-quote characters.
  6. Fields with leading or trailing spaces should be enclosed within double-quote characters, although leading and trailing spaces for unquoted values are not trimmed.
  7. Fields may always be enclosed within double-quote characters, whether necessary or not.

Response

The following is an example response when the download has successfully completed. The data shown is representative of a small Simple Database table with 5 columns and 7 rows of data.

Important: This response will be in CSV format, and not in JSON.

question1,question2,outbound_result,phone_number,name
yes,yes,success,2125551234,bob
no,yes,success,6175551412,larry
,,,,invalid
yes,yes,,6175554123,jonathon
,,,6175553154,jerry
,,,6175554773,vicky
yes,yes,,6175552413,samuel

This webservice will only issue a JSON response if there was an error, and its format will be typical of other error responses.

api/sdb_download_csv.txt · Last modified: 2013/04/09 17:07 by victor