...
When using the API the default action is determined according to the format and URL. You can override this by providing the 'action' option in the URL. An example of this is when creating a new item. You would normally use POST to /item but in the case of a web user, you need a web form to be able to fill out the item details. In that case, there is no facility for this in a typical JSON Restful API. We work around this by providing action=create in a GET request for the URL. IE - http://{server}/omk/open-audit/networks?action=create. The default action if nothing matches below is to return a collection of items.
API Routes
Request | Name | ID | Result | Implemented | ||||||
---|---|---|---|---|---|---|---|---|---|---|
GET | Return a collection of items | Y | ||||||||
GET | create | Show an HTML form to create a new item. | Y | |||||||
GET | import | Show an HTML form to import a list of items using a CSV. | Y | |||||||
GET | read | Y | Show the details of an item (and aloow edit if user has permission). | YMethod | ID | Action | Resulting Function | Permission Required | URL Example | Notes |
POST | n | create | {collection}::create | /{collection} | Insert a new {collection} entry. | |||||
GET | y | read | {collection}::read | /{collection}/{id} | Returns a {collection} details. | |||||
PATCH | y | update | {collection}::update | /{collection}/{id} | Update an attribute of a {collection} entry. | |||||
DELETE | y | delete | {collection}::delete | /{collection}/{id} | Delete a {collection} entry. | |||||
GET | n | collection | {collection}::read | /{collection} | Returns a list of {collection}. |
Web Application Routes
Request Method | ID | Action | Resulting Function | Permission Required | URL Example | Notes |
---|---|---|---|---|---|---|
GET | n | create | create_form | {collection}::create | /{collection}/create | Displays a standard web form for submission to POST /{collection}. |
GET | y | update | update_form | {collection}::update | /{collection}/{id}/update | Show the script details with the option to update attributes using PATCH to /{collection}/{id} |
GET | n | import | import_form | {collection}::create | /{collection}/import | Displays a standard web form for submission to POST /{collection}/import. |
POST | n | import | import | {collection}::create | /{collection}/import | Import multiple {collection} using a CSV. |
Sort
To sort by a database column, user "sort={attribute}". To reverse sort, insert a minus, thus "sort=-{attribute}".
...