Connecting to your Database
Connect to your database using a simple, secure HTTPS Request/Response.
  1. Send a HTTP POST to the SchemafreeSQL service url (e.g. https://svc.schemafreesql.com/api).
    • Set the value of HTTP header x-sfdb-access-key to your account access key.
    • Set the POST payload according the JSON-formatted Request Payload Format (see below).
  2. Receive the JSON HTTP response (see below).
HTTP Request
Send your JSON-formatted request as an HTTP POST.


Example request containing 2 commands (modify and query), along with sample parameters:
	
	[ 
	   {"modify": {
	      "data":[
	         {"s:companyName": "ABC Inc."},	
	         {"s:companyPhone": "100-200-3000"}]
	   }},
	   {"query": {
	      "sfql": "SELECT $s:companyName, $s:companyPhone",
	      "_commandID": "q1",
	   }}
	]	             
					

The parameter "_commandID" is a user-defined "reflective" parameter.
Any parameter you prefix with "_" (underscore) will be reflected back to you within the response.

You can attach as many of these to a command call as you need. The example reflective parmameter "_commandID" would be useful for reference purposes (e.g. to distinguish one query result from the rest when issuing a batch of queries in a single request)

All other allowed parameters (e.g. poid, data and sfql) are dictated by the particular command being issued.


Grammar
POST Payload (an array of Commands)
HTTP_Request_Payload
Command
Command
Parameter
Parameter

HTTP Response
Receive your JSON-formatted response.


Example response for the commands in the above example request:
	[ 
	   { "cmdname":"modify"},
	   { "cmdname":"query", "_commandID":"q1",
	     "data": [{"s:companyName":"ABC Inc.", "s:companyPhone":"100-200-3000"}]
	   }
	]
					
There are several standard attributes for response objects. The rest are dictated by the specific command for which they are responding.

Standard response attributes

cmdnameALWAYS_RETURNED: Matches the COMMAND_NAME of the incoming command
errorcodeCONDITIONAL: A non-zero value or absence of errorcode signifies no error was generated, otherwise contains the specific numeric error code which will be local to the specific command if error occured within command.
errormsgCONDITIONAL: descriptive error message if a non-zero errorcode was returned.
dataCONDITIONAL: If the command generates data, it will be returned here.
warningcodeCONDITIONAL: A non-zero value indicates a warning was generated and contains the specific numeric warning code.
warningmsgCONDITIONAL: descriptive warning message if non-zero warningcode was returned.



Grammar
Response Payload
HTTP_Response_Payload
Command_Response
Command_Response

Where:
Command_Response_Attr_Value is a JSON Object or JSON Array.