A CRUD page exposes a number of REST API methods by default. They are detailed below. All methods produce JSON objects, and some of them accept JSON as input as well.
- Basic SCRUD:
GET /?searchString=...&firstResult=...&maxResults=...&sortProperty=...&sortDirection=...- do a search query, potentially paginated. All parameters are optional. Besides search results, this method returns, in HTTP headers, links to the first, last, previous and next page of results.
searchStringan URL-encoded representation of the search form (search_param_1=value_1&...&search_param_n=value_n). This is the same string that is posted around in the CRUD web UI to remember the current search.
firstResultindex of the first returned object. Defaults to 0.
maxResultsmaximum number of returned results. Defaults to the value configured in the CRUD page.
sortPropertyif specified, results are sorted according to this property.
sortDirectionif specified, controls how results are sorted. Can assume the values "asc" (ascending) and "desc" (descending).
GET /object_pk- load an object by primary key. The key is formatted as in CRUD URLs in the user-facing web UI. In particular, composite keys are encoded as k1/.../kn.
POST /- create a new object. This method accepts JSON objects as they are returned by GET /pk or a multipart request (the only way of submitting attachments).
PUT /object_pk- update an existing object. This method accepts JSON objects as they are returned by GET /pk or a multipart request (the only way of submitting attachments).
DELETE /object_pk- delete an object.
GET/PUT/DELETE /:blob/propertyName- operate on a single blob property, independently of the whole object. For PUT, specifically, the file name can be specified with the filename query string parameter, the contents are read from the body of the request, and the MIME type is read from the Content-Type header.
GET /:classAccessor- returns a JSON object describing the objects managed by this CRUD action.
GET /:selectionProviders- returns a JSON array with information about the available selection providers.
GET /:selectionProvider/selectionProviderName[/selectionProviderIndex]?prefix=...&includeSelectPrompt=...- returns a JSON array with values to fill a selection list. The only mandatory parameter is the selectionProviderName. Optional parameters:
- selectionProviderIndex can be used in case of multiple dependent select boxes, to get values for the nth field.
- prefix is the prefix of the form (to read values from the request if the original form has a prefix).
- includeSelectPrompt controls whether to include an empty "Select a ..." entry at the beginning of the returned array.