nested data in make_request box_sdk
Hi,
I am using box-python-sdk for one of my projects. I need to create new group membership.
This is what I tried
json_response = client.make_request( 'POST', client.get_url('group_memberships'), data={'user':{'id': user.box_id,}, 'group':{'id':group_id,}, 'role': role } ).json()
but it gives me the following error
Message: Bad Request Status: 400 Code: bad_request Request id: m28r30fnd4lr82wp Headers: {'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'BOX-REQUEST-ID': '8aq55fovtr9uhedgpi1ph1hci1', 'Age': '0', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Vary': 'Accept-Encoding', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, no-store', 'Date': 'Thu, 11 Jan 2018 16:19:54 GMT', 'Content-Type': 'application/json'} URL: https://api.box.com/2.0/group_memberships Method: POST Context info: {u'errors': [{u'reason': u'invalid_parameter', u'message': u"Invalid value 'role=admin&group=id&user=id'. Entity body should be a correctly nested resource attribute name/value pair", u'name': u'entity-body'}]}
I think that's because box api's _make_request adds the content-type to multipart data and not possible to override this.
is there any workaround this issue?
Please sign in to leave a comment.
Comments
0 comments