Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Y
Request
NameIDResultImplemented
GET  Return a collection of itemsY
GETcreate Show an HTML form to create a new item.Y
GETimport Show an HTML form to import a list of items using a CSV.Y
GETreadYShow the details of an item (and aloow edit if user has permission).
Method
ID
Action
Resulting Function
Permission Required
URL Example
Notes
POSTn create{collection}::create/{collection}Insert a new {collection} entry.
GETy read{collection}::read/{collection}/{id}Returns a {collection} details.
PATCHy update{collection}::update/{collection}/{id}Update an attribute of a {collection} entry.
DELETEy delete{collection}::delete/{collection}/{id}Delete a {collection} entry.
GETn collection{collection}::read/{collection}Returns a list of {collection}.

Web Application Routes

Request Method
ID
Action
Resulting Function
Permission Required
URL Example
Notes
GETncreatecreate_form{collection}::create/{collection}/createDisplays a standard web form for submission to POST /{collection}.
GETyupdateupdate_form{collection}::update/{collection}/{id}/updateShow the script details with the option to update attributes using PATCH to /{collection}/{id}
GETnimportimport_form{collection}::create/{collection}/importDisplays a standard web form for submission to POST /{collection}/import.
POSTnimportimport{collection}::create/{collection}/importImport multiple {collection} using a CSV.

 

 

 

Sort

To sort by a database column, user "sort={attribute}". To reverse sort, insert a minus, thus "sort=-{attribute}".

...