The response data for GET
operations is a list of JSON
items.
For POST
operations, such as UPDATE
and
CREATE
, the input format is a structure with a data
field that contains the JSON list of items. UPDATE
and
CREATE
operations process one item at a time, so
the list is exactly one entry long. The response data for
POST
operations is the updated item, matching a
GET
with detail=1
for the item, as
demonstrated in Example 1.
For item updates, it is only necessary to specify the fields you are updating. Arcadia Enterprise merges the supplied fields in the input data with the existing item's data, as demonstrted in Example 2.
payload = {'name':'System Admin'}
session.post(api_url + '/roles/1', data={'data':json.dumps([payload])})
response = session.get(api_url + '/roles/2?detail=1')
role = response.json()[0]
if 'new_user' not in role['users']:
payload = {'users':role['users'] + ['new_user']}
session.post(api_url + '/roles/2', data={'data':json.dumps([payload])})
For the definition of fields for each data type, see Data Type Details.