Sign In

AppSynergy REST API

The AppSynergy REST API allows you to make RESTful calls to your database. Each API action is documented below.

HTML2PDF – PDF Generation

Generates a PDF document from the provided HTML and stores it in your database storage bucket. The response contains a reference to that document in AppSynergy Document Field format.

Request

POST https://www.appsynergy.com/api?action=HTML2PDF&apiKey=YOUR_API_KEY { "filename": "HelloWorld.pdf", "html": "<html><body><h1>Hello World</h1></body></html>" }

Response

{ "status": "OK", "errorMessage": "", "errorCode": "", "data": { "documentField": "HelloWorld.pdf;1048;1598992707098;database/files/a655f610-febd-4f6a-b11d-6bcd696f5456.pdf" } }

EXEC_QUERY – Execute an SQL Query

Executes an SQL query and returns the results in either JSON or CSV format. You can execute an SQL command like SHOW TABLES to see which tables are available.

Request

POST https://www.appsynergy.com/api?action=EXEC_QUERY&apiKey=YOUR_API_KEY { "sqlCmd": "SELECT * FROM MyTable", "responseFormat": "JSON" }

Response

If responseFormat was CSV:

Customer_ID,Name 1000,"Company A" 1001,"Company B"

If responseFormat was JSON:

{ "status": "OK", "errorMessage": "", "errorCode": "", "data": { "columns": [ { "tableName": "Customers", "columnName": "Customer_ID", "datatype": "BIGINT" }, { "tableName": "Customers", "columnName": "Name", "datatype": "VARCHAR" } ], "rows": [ { "values": [ { "value": "1000" }, { "value": "Company A" } ] }, { "values": [ { "value": "1001" }, { "value": "Company B" } ] } ] } }

EXEC_DML – Execute an SQL DML Statement

Executes an SQL DML statement (e.g. INSERT, UPDATE, DELETE) and returns the number of rows affected.

Request

POST https://www.appsynergy.com/api?action=EXEC_DML&apiKey=YOUR_API_KEY { "sqlCmd": "UPDATE MyTable SET MyCol = 123 WHERE ID = 100" }

Response

{ "status": "OK", "errorMessage": "", "errorCode": "", "data": { "rowsAffected": 1 } }

Authentication Options

You may specify the API Key as a URL parameter as shown in the above examples, or alternatively as an HTTP request header in Bearer Authentication format as shown below:

Authorization: Bearer YOUR_API_KEY

Other Considerations

Actions must complete in less than 60 seconds.

API Request/Response size is limited to ~16MB.

By default API calls are limited to a certain number per hour to prevent runaway systems; the actual number is configurable via the API user's MAX_CONNECTIONS_PER_HOUR resource option (the default is 500).

Diagnosing Problems

If you run into problems, try issuing a command like the following via Tools > SQL Console... to diagnose what went wrong:

SELECT * FROM parasql_http_request ORDER BY id DESC LIMIT 1