Skip to main content
Question

Box PATCH users API - Unable to post the tracking_codes configuration

  • May 22, 2025
  • 4 replies
  • 55 views

Forum|alt.badge.img

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"
        }
    ]
}

4 replies

Forum|alt.badge.img

Same problem here.  Anyone ever get this to work?

 

Mike


Forum|alt.badge.img

 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? 


Forum|alt.badge.img

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 PUT
 
Thanks,
 
Mike

Forum|alt.badge.img

Where to find the settings for tracking codes:

 

"Prior to that call being successful, you'll have to set up tracking code definitions in the admin console > enterprise settings > user settings > user tracking codes. In this case, it would be "employee_id"

 

(Box tech support)

 

Mike