General DB

How To Extract Rows Into Another App

To extract rows from General DB or Private DB into another app, use the x-callback-url interface.

For a great working example, see the When the General Calls workflow by David Edson.

All parameters described below should be URL-encoded according to rfc1738.

For increased safety, the database is opened in read-only mode.

Request URL

Use the scheme generaldb for General DB, and the scheme privatedb for Private DB.

generaldb://x-callback-url/execute-select-statement
    

Required Parameters

x-success is the URL that will be opened if the select statement succeeded.

statement is the select statement to execute.

Optional Parameters

x-error is the URL that will be opened if the select statement failed.

x-source is the name of the source app.

database is the name of the database file to use. If not specified, then general.db will be used.

Response Parameters

rows contains the rows in one URL-encoded string if the select statement succeeded. Each row is delimited by a newline character 0x0A, and each field by a tab character 0x09.

errorCode is the integer error code if the select statement failed.

errorMessage is a string describing the error if the select statement failed.

Example Request from the Workflow App

generaldb://x-callback-url/execute-select-statement?
statement=select%20*%20from%20MyTable&
x-cancel=workflow://x-callback-url/ic-cancel/D08EA2C0-348D-4699-9C12-4E1CE98CA52B&
x-error=workflow://x-callback-url/ic-error/D08EA2C0-348D-4699-9C12-4E1CE98CA52B&
x-source=Workflow&
x-success=workflow://x-callback-url/ic-success/D08EA2C0-348D-4699-9C12-4E1CE98CA52B
    

Example Response from the Workflow App

workflow://x-callback-url/ic-success/D08EA2C0-348D-4699-9C12-4E1CE98CA52B?
x-source=General%20DB&
rows=2016-07-03%20-0400%09Hello%0A2016-07-04%20-0400%09World