I was following the API Reference to add a collaboration.
payload = {
"item": {
"type": "folder",
"id": folder_id
},
"accessible_by": {
"type": "user",
"login": "abc@def.com"
},
"role": "viewer",
"notify": "false"
}
headers = {
'Authorization': "Bearer %s" % access_token,
'Content-Type': 'application/json'
}
response = requests.post('https://api.box.com/2.0/collaborations', headers=headers, data=payload)
returns:
{'type': 'error', 'status': 400, 'code': 'bad_request', 'context_info': {'errors': [{'reason': 'invalid_parameter', 'name': 'entity-body', 'message': "Invalid value 'item=type&item=id&accessible_by=type&accessible_by=login&role=viewer&
notify=false'. Entity body should be a correctly nested resource attribute name/value pair"}]}, 'help_url': 'http://developers.box.com/docs/#errors', 'message': 'Bad Request',
'request_id':12345}
