Skip to content

Docs (Initiation)

DanDayne edited this page Nov 24, 2019 · 8 revisions

FUNCTIONALITY: Creates nodes and assigns corresponding devices to it.

ENDPOINT: /initiate

TYPE: POST

URL ARGUMENTS: -

POSSIBLE RESPONSES:

  • 200, {node_id: {device_type: 1/0}} -> 1 = success, 0 = failure

  • 400, [errors] -> implies that a bad initiation protocol was provided or other conflict has occured. Returns list of error messages

  • 401, 'Invalid Credentials' -> invalid credentials in the auth argument in post

  • 500, error message -> error occured on PBRcontrol, report immediately

    -> returns dictionary of requested node_ids, each has a dict of requested devices. If the device was initiated, its value in the dict is 1, otherwise 0 (e.g. if the device already exists on node. This can happen by user trying to initiate multiple devices of the same type on one node)

    -> if the node already exists, initiation will fail and the value of node_id in dict will be False

DATA: Dictionary of nodes specified in Protocol.


Example

import requests
requests.post('https://localhost:5000/initiate', str(node), verify=False, auth=('user', 'passwd'))

where node is defined in Protocol example.

Clone this wiki locally