summaryrefslogtreecommitdiffstats
path: root/testapi/docs/developer/devguide/testapi-client-import.rst
blob: 69cb6ad393ce9de2d8bd5ebc1241f9ecc0bfb978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) 2017 ZTE Corp.

=====================
TestAPI client import
=====================

**Python module to communicate with the TestAPI Server**

This project aims to provide a python module which can
communicate with the TestAPI Server. The user can use this client
to fetch/post/modify the resources on the TestAPI Server.

Usage
-----

Pod
^^^

GET
"""

User will get the json Pod objects with the get request.

.. code-block:: shell

    from testapiclient.client import pods

    pod_client = pods.PodsClient()
    pod_client.get()

User can use search parameters to get pods

.. code-block:: shell

    from testapiclient.client import pods

    pod_client = pods.PodsClient()
    pod_client.get(name='pod1')

GET ONE
"""""""

User will get the json Pod objects with the get request.

.. code-block:: shell

    from testapiclient.client import pods

    pod_client = pods.PodsClient()
    pod_client.get_one('name')

CREATE
""""""
User has to authenticate before running the function.

.. code-block:: shell

    from testapiclient.client import pods

    pod_client = pods.PodsClient(user='test', password='pass')
    pod_client.create({'name': 'test-api', 'mode':'metal',
                    'role':'community_ci', 'details':''}