Using BearDB REST Server to INSERT data

BearDB supports the ability for REST clients to INSERT data into a database table one record at a time using a REST INSERT.
When data is added to any relational database, it is the responsbility of the client to know the table structure and its rules. If data is inderted which does not match the schema of a particular table, then the SQL INSERT operation will fail and a detailed error will be returned with the reason for the failure.


To create a proper REST INSERT for the BearDB REST Server, the following settings should be used for the REST reqeuest:

REST OperationPOST
REST URL[server]:[port]/beardb/rest/table/[tableName]
HTTP Parameter(s)    column1=my data&column2=more data&column3=Some value

The complete HTTP request is the following:

POST server:port/beardb/rest/table/myTestTable?column1=my%20data&column2=more%20data&column3=Some%20value

This is the equivalent SQL query:

    INSERT INTO myTestTable (column1, column2, column3) VALUES ('my data','more data','Some value')

Notes on using a REST INSERT:

  • Parameters in a REST INSERT are used as the data values to be inserted into the table. Any columns in a table which cannot be NULL (AllowNull = true) must be specified as a parameter in a REST INSERT.
  • A REST INSERT must use POST. GET is reserved for a REST Query.
  • If attempting to INSERT data which does not match the data type, NULL-ability, or column names of a given table, the INSERT operation will fail and the client will get an error in the response..