Skip to content

Commit

Permalink
IVIS-46: - Update API chapter (users).
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanPopenko committed Oct 26, 2016
1 parent dada8f0 commit 17ebd3b
Show file tree
Hide file tree
Showing 3 changed files with 269 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/api/role.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
List of properties from Role
============================

#. id(NUMBER)
#. name(STRING)

Example of response:
~~~~~~~~~~~~~~~~~~~~

.. code-block:: json
{
"id" : 0,
"name" : ""
}
31 changes: 31 additions & 0 deletions docs/api/user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
List of properties from User
============================

#. id(NUMBER)
#. name(STRING)
#. person(OBJECT)
type of `Person <http://docs.ivis.se/en/latest/api/person.html>`_
#. roles(ARRAY)
type of `Role <http://docs.ivis.se/en/latest/api/role.html>`_
#. saml2_id(STRING)

Example of response:
~~~~~~~~~~~~~~~~~~~~

.. code-block:: json
{
"id" : 0,
"name" : "",
"person" : {
"id" : null,
"personal_id" : null,
"first_name" : null,
"last_name" : null,
"addresses" : { },
"emails" : { },
"phones" : { }
},
"roles" : [ ],
"saml2_id" : ""
}
223 changes: 223 additions & 0 deletions docs/api/users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,230 @@ Users

Provides following method for `API <index.html>`_ calls:

* `Get user`_
* `Get users`_
* `Save user`_
* `Save users`_
* `Update user`_
* `Delete user`_
* `Get user or users by personal id`_
* `Get current`_
* `Get logged in`_

.. _`Get user`:

Get user
--------

URL:
~~~~
*/users/{id}*

Method:
~~~~~~~
*GET*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*null*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*Object*

*With properties:*
#. id(NUMBER)
#. name(STRING)
#. person(OBJECT)
type of `Person <http://docs.ivis.se/en/latest/api/person.html>`_
#. roles(ARRAY)
type of `Role <http://docs.ivis.se/en/latest/api/role.html>`_
#. saml2_id(STRING)

Example of response:
~~~~~~~~~~~~~~~~~~~~

.. code-block:: json
{
"id" : 0,
"name" : "",
"person" : {
"id" : null,
"personal_id" : null,
"first_name" : null,
"last_name" : null,
"addresses" : { },
"emails" : { },
"phones" : { }
},
"roles" : [ ],
"saml2_id" : ""
}
.. _`Get users`:

Get users
---------

URL:
~~~~
*/users*

Method:
~~~~~~~
*GET*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*null*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*Array*

.. seealso::

Array consists of objects from `Get user`_ method

Save user
---------

URL:
~~~~
*/users*

Method:
~~~~~~~
*POST*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*OBJECT(User)*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*OBJECT(User)*

Null properties:
~~~~~~~~~~~~~~~~
*id*

Save users
----------

URL:
~~~~
*/users*

Method:
~~~~~~~
*POST*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*Array(User)*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*Array(User)*
Null properties of every object in array:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*id*

.. _`Update user`:

Update user
-----------

URL:
~~~~
*/users/{id}*

Method:
~~~~~~~
*PUT*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*OBJECT(User)*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*OBJECT(User)*

.. note::

property will be updated, if you don't want update property it need set null

.. _`Delete user`:

Delete user
-----------

URL:
~~~~
*/users/{id}*

Method:
~~~~~~~
*DELETE*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*null*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*OBJECT(User)*

.. note::

you receive deleted object

.. _`Get user or users by personal id`:

Get user or users by personal id
-----------------------------

URL:
~~~~
*/users*

Method:
~~~~~~~
*GET*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*personalId(STRING)*
and optional *first(BOOLEAN)*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*ARRAY or OBJECT (User)*

.. _`Get current`:

Get current
-----------

URL:
~~~~
*/users/current*

Method:
~~~~~~~
*GET*

Parameters request:
~~~~~~~~~~~~~~~~~~~
*null*

Parameters response:
~~~~~~~~~~~~~~~~~~~~
*Object*

.. _`Get logged in`:

Get logged in
Expand All @@ -32,6 +254,7 @@ Parameters response:
#. id (Number)
#. person (Object)
#. roles (Array)
type of `Role <http://docs.ivis.se/en/latest/api/role.html>`_

.. note::
roles consist of objects with properties: *id* and *name*
Expand Down

0 comments on commit 17ebd3b

Please sign in to comment.