Box PATCH users API - Unable to post the tracking_codes configuration
As per the reference doc : https://developer.box.com/reference
For Update user API : https://api.box.com/2.0/users/:user_id, we can pass the "tracking_codes" as An array of key/value pairs set by the user’s admin.
I tried using the same in my payload as below but it does not work giving error as "invalid request parameter"
{
"tracking_codes": [
{
"status": "cannot_delete_edit"
}
]
}
-
The use of tracking codes must be enabled by your customer success manager as noted here: https://community.box.com/t5/How-to-Guides-for-Admins/Configuring-User-Tracking-Codes/ta-p/235. Have you done this?
-
Hi,
Yes, I heard back from tech support. I didn't know that after tracking codes are enabled, a new setting appears and you have to define which codes you will accept. Since the actual structure of what needs to be passed is not documented anywhere I could find, I will post what works for me:
upd[ 'tracking_codes' ] = [
{
'type': 'tracking_code',
'name': 'ACode',
'value': value
}
]The above example is Python. The 'ACode' value needs to be defined in the admin interface. 'upd' is a dict and in this case is the dictionary passed to the update call for a user. For adding users, just pass the list using the tracking_codes keyword. The JSON serializer in the API will convert the above to the appropriate text for the POST.
This is the curl command tech support sent me:
-H "Authorization: Bearer {{AccessToken}}" \-d '{"tracking_codes":[{"type":"tracking_code","name":"employee_id","value":"123123123"}]}' \-X PUTThanks,Mike
Please sign in to leave a comment.
Comments
4 comments