Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTful API in CakePHP, and docs #403

Merged
merged 35 commits into from
Apr 25, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2c94183
Initial commit of CakePHP 2.5.0-RC1 for the API
kylejohnson Apr 23, 2014
5e56a5a
Initial commit of Monitor Model
kylejohnson Apr 23, 2014
8a70747
Initial commit of Config Model
kylejohnson Apr 23, 2014
51eced4
Initial commit of Event Model
kylejohnson Apr 23, 2014
92e2212
Initial commit of Zone Model
kylejohnson Apr 23, 2014
53c8f05
Added htaccess file to allow rewriting
kylejohnson Apr 23, 2014
8e88fbe
Added routes for monitors xml / json
kylejohnson Apr 23, 2014
2ee9ffd
Initial index, view, edit, update and delete functions for Monitors
kylejohnson Apr 23, 2014
f975688
Initial xml and json views for Monitor index
kylejohnson Apr 23, 2014
485f1b6
Initial xml and json views for Monitor view
kylejohnson Apr 23, 2014
30657db
Initial index, view, edit, update and delete functions for Zones
kylejohnson Apr 23, 2014
bb7cd76
Initial xml and json views for Zone index and view
kylejohnson Apr 23, 2014
ed8bc57
Added a route for zones
kylejohnson Apr 23, 2014
b2ad265
Added a route for configs
kylejohnson Apr 23, 2014
af91a14
Initial index, view, edit and delete functions for Configs
kylejohnson Apr 23, 2014
159a1ec
Initial xml and json views for Config index and view
kylejohnson Apr 23, 2014
710bb96
Added a route for events
kylejohnson Apr 25, 2014
5385e20
Initial index, view, edit and delete functions for Events
kylejohnson Apr 25, 2014
5cabbe2
Initial xml and json views for Event index and view
kylejohnson Apr 25, 2014
c836b81
Initial commit of Frame Model
kylejohnson Apr 25, 2014
814359a
Added a route for frames
kylejohnson Apr 25, 2014
0bae740
Initial index, view, edit and delete functions for Frames
kylejohnson Apr 25, 2014
7ced617
Frames are deleted when their parent Event is
kylejohnson Apr 25, 2014
b86c3f1
Zones are deleted when their parent Monitor is
kylejohnson Apr 25, 2014
54a105a
Ability to edit monitor via api by passing in array
kylejohnson Apr 25, 2014
78ef097
Return the correct message when updating a monitor
kylejohnson Apr 25, 2014
2e3900d
Ability to edit event via api by passing in array
kylejohnson Apr 25, 2014
5843f12
Ability to edit zone via api by passing in array
kylejohnson Apr 25, 2014
48304d2
Initial commit of Sphinx docs directory
kylejohnson Apr 25, 2014
643e1aa
Added docs/_build to .gitignore
kylejohnson Apr 25, 2014
8dd7d3e
Initial commit of documentation for the API
kylejohnson Apr 25, 2014
2004a5d
Ability to edit a config via api by passing in an array
kylejohnson Apr 25, 2014
e65e170
Added api doc for editing configs
kylejohnson Apr 25, 2014
0d906d4
Added api doc for adding a monitor
kylejohnson Apr 25, 2014
e18c4b5
Added api doc for adding a zone
kylejohnson Apr 25, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initial commit of documentation for the API
  • Loading branch information
kylejohnson committed Apr 25, 2014
commit 8dd7d3e93450aca6cfae4e2638ba612542ed06e1
70 changes: 70 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
API
===

This document will provide an overview of ZoneMinder's API.

Overview
--------

In an effort to further 'open up' ZoneMinder, an API was needed. This will
allow quick integration with and development of ZoneMinder.

The API is built in CakePHP and lives under the ``/api`` directory. It
provides a RESTful service and supports CRUD (create, retrieve, update, delete)
functions for Monitors, Events, Frames, Zones and Config.

Examples
--------

Here be a list of examples. Some results may be truncated.

You will see each URL ending in either ``.xml`` or ``.json``. This is the
format of the request, and it determines the format that any data returned to
you will be in. I like json, however you can use xml if you'd like.

Return a list of all monitors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``curl -XGET http://zmdevapi/monitors.json``

Retrieve monitor 1
^^^^^^^^^^^^^^^^^^
``curl -XGET http://zmdevapi/monitors/1.json``

Edit monitor 1
^^^^^^^^^^^^^^

This command will change the 'Name' field of Monitor 1 to 'tits'

``curl -XPUT http://zmdevapi/monitors/1.json -d "Monitor[Name]=tits"``

Delete monitor 1
^^^^^^^^^^^^^^^^

This command will delete Monitor 1, but will _not_ delete any Events which
depend on it.


``curl -XDELETE http://zmdevapi/monitors/1.json``

Return a list of all events
^^^^^^^^^^^^^^^^^^^^^^^^^^^

``curl -XGET http://zmdevapi/events.json``

Retrieve event 1
^^^^^^^^^^^^^^^^
``curl -XGET http://zmdevapi/events/1.json``

Edit event 1
^^^^^^^^^^^^

This command will change the 'Name' field of Event 1 to 'Seek and Destroy'

``curl -XPUT http://zmdevapi/events/1.json -d "Event[Name]=Seek and Destroy"``

Delete event 1
^^^^^^^^^^^^^^
This command will delete Event 1, and any Frames which depend on it.

``curl -XDELETE http://zmdevapi/events/1.json``
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Contents:
.. toctree::
:maxdepth: 2

api



Indices and tables
Expand Down