GET Tables
/v1/tables
Method: GET
Description: Returns the list of available tables
Parameters: None
Result: Array of tables names
GET Table Name
/v1/tables/<name>
Method: GET
Description: Returns the description of a table
Parameters: None
Result: Object describing the table
GET Table Rows
/v1/tables/<name>/rows
Method: GET
Description: Returns rows from the table
Parameters: URL, optional – Select criterion, if absent, ALL is assumed.
Result: Rows from the table
Example
Retrieve all records from table Customers that were submitted today:
Method: GET
URL: /v1/tables/customers/rows?q={"select":"Contact_ID, First_Name, Last_Name", ProductsOrdered", "where":"Date_Submitted>=GetDate()"}
Brackets and the parameters within them must be encoded. See all Special Considerations and note the required Header Parameters.
Response Example
JSON:
"Result": [{ "Contact_ID": 112, "First_Name": "Jane", "Last_Name": "Anderson", "ProductsOrdered":{ "1": "Product1", "3": "Product3", } }]
XML:
<Caspio> <Row> <Contact_ID>112</Contact_ID> <First_Name>Jane</First_Name> <Last_Name>Anderson</Last_Name> <ProductsOrdered> <item Key="1" Value="Product1" /> <item Key="3" Value="Product3" /> </ProductsOrdered> </Row> </Caspio>
POST Table Rows
/v1/tables/<name>/rows
Method: POST
Description: Inserts a row into the table
Parameters: URL,
Body, required – {“field1″:”value1″,”field2″:”value2”, “listField”:[1,3]}
Result: 201 Created (if successful) + Location Header contains URL to inserted row
PUT Table Rows
/v1/tables/<name>/rows
Method: PUT
Description: Updates rows in the table. It must include a query that specifies the row(s) that should be updated.
Parameters: URL, required – Update criterion,
Body, required – {“field1″:”value1″,”field2″:”value2”,“listField ”:[1,3]}
Result: Affected rows count
Example
Update all Customers where Name equals Mike, set Status to “Updated”:
Method: PUT
URL: /v1/tables/customers/rows?q={"where":"Name='Mike'"}
Body: {"Status":"Updated"}
Brackets and the parameters within them must be encoded. See all Special Considerations and note the required Header Parameters.
DELETE Table Rows
/v1/tables/<name>/rows
Method: DELETE
Description: Deletes rows from the table
Parameters: URL, required – Delete criterion (described in Criteria section)
Result: Affected rows count
GET Table Password Fields
/v1/tables/<name>/passwordFields
Method: GET
Description: Returns a list of table password fields
Parameters: None
Result: A list of table password fields
PUT Table Password Fields
/v1/tables/<name>/passwordFields/<pfName>
Method: PUT
Description: Update table password field value
Parameters: URL, required – Update criterion (described in Criteria section); Body, required – {“value”:”pfValue”}
Result: Affected rows count
DELETE Table Password Fields
/v1/tables/<name>/passwordFields/<pfName>
Method: DELETE
Description: Reset table password field value
Parameters: URL, required – Delete criterion
Result: Affected rows count
GET Table Fields
/v1/tables/<name>/columns
Method: GET
Description: Returns list of fields from the table
Parameters: None
Result: List of fields
POST Table Fields
/v1/tables/<name>/columns
Method: POST
Description: Adds a field into the table
Parameters: URL,
Body, required –
{
“Name”:”columnName”, (required)
“Type”:”columnType”, (required)
“Unique”:(true/false), (optional, default value = false)
“Description”:”description”, (optional, default value = “”)
“DisplayOrder”:(integer), (optional, default value = 0 (last))
“Label”:”label”, (optional, default value = “”)
“UniqueAllowNulls”:(true/false), (optional, only if UNIQUE set to TRUE, default value = false)
“OnInsert”:(true/false), (optional, only for TIMESTAMP, default value = false)
“OnUpdate”:(true/false), (optional, only for TIMESTAMP, default value = false)
“TimeZone”:”timeZone” (optional, only for TIMESTAMP, default value = “”)
“ListOptions”: [“value1”,”value2”, …] (optional, only for list type)
}
Result: 201 Created (if successful) + Location Header contains URL to inserted column
GET Table Field
/v1/tables/<name>/columns/<columnName>
Method: GET
Description: Returns the field information
Parameters: None
Result: Field’s information
Name – Field name
Type – DataType
Unique – True/False – Indicates if the field is unique
Description – Field’s description
DisplayOrder – Display order of the field
Label – Field’s label
UniqueAllowNulls – True/False – Indicates if Null is allowed in the unique field
OnInsert – True/False – Indicates if TIMESTAMP is enabled on insert
OnUpdate – True/False – Indicates if TIMESTAMP is enabled on update
TimeZone – Time zone of the TIMESTAMP
ListOptions – {“optionId”:”optionValue”,…} – all possible values of list column, only for list type columns
PUT Table Field
/v1/tables/<name>/columns/<columnName>
Method: PUT
Description: Updates a field in the table
Parameters: URL,
Body, requires at lease one optional parameter –
{
“NewName”:”columnName”, (optional)
“NewType”:”columnType”, (optional)
“NewUnique”:(true/false), (optional)
“NewDescription”:”description”, (optional)
“NewDisplayOrder”:(integer), (optional)
“NewLabel”:”label”, (optional)
“NewUniqueAllowNulls”:(true/false), (optional, only if UNIQUE set to TRUE)
“NewOnInsert”:(true/false), (optional, only for TIMESTAMP)
“NewOnUpdate”:(true/false), (optional, only for TIMESTAMP)
“NewTimeZone”:”timeZone” (optional, only for TIMESTAMP)
“NewListOptions”: [“value1”, “value2”,…] (optional, only for list columns)
}
Result: 200 OK if successful
DELETE Table Field
/v1/tables/<name>/columns/<columnName>
Method: DELETE
Description: Deletes a field from the table
Parameters: None
Result: 200 OK if successful