API: How to delete/empty values

henrik_schack
New Contributor II

Hi
I'm attempting to use the PUT /computers/serialnumber/{serialnumber} API endpoint to perform updates.
Adding/updating entries works fine.
What's the trick in removing values from the record in Jamf? ex replace a phone number with a blank field.
Adding an empty XML tag or a tag containing a space character does not work.

7 REPLIES 7

Mauricio
Contributor III

Hello Henrik
I've done a test here with the computer UUID to remove a value and works fine, no need of spaces, just the tags.
Example of my test
1269468730c245f1a0db9d6ce93e0881

Hope this helps
Regards

henrik_schack
New Contributor II

I can delete some values values, but I'm having no luck with phone_number and position.

Mauricio
Contributor III

Hello Henrik
I can confirm that is happening here too, the API to PUT "empty" info returns 201 but nothing changes.
New info like "N/A" is OK (a possible workaround?)
Via the UI one can remove the info and leave blank.
I think this is a call to Jamf Support
Regards

SamF
Contributor II
Contributor II

The phone_number and position fields are part of the user object not the device, and should be updated via the /users/id/{id} endpoint instead of via the device record those users are associated with.

henrik_schack
New Contributor II

Ahaaa, that explains it, thanks a lot!

Mauricio
Contributor III

@Sam.Fortuna

Hello Sam
Thanks for that!
I've managed to change those values via the computer end point (not to empty but to a new value).
Would that be a possible issue/conflict between endpoints?
Regards

SamF
Contributor II
Contributor II

@Mauricio I'm not sure what the intended behavior is here, but considering you can update the values without using the /users endpoint to certain values and not others, I would consider that inconsistency a product issue. It's possible the fix would be to prevent changing of those values via endpoints other than /users, but that's not necessarily bad. It's probably worth opening a support ticket.

One thing to keep in mind when updating values associated with user objects is that any other devices also associated with that user will have their values updated as well. Intuitively this makes more sense when you're interacting with the /users endpoint, but since you're able to update those values via both the /computers and /mobiledevices endpoints, it may not be as apparent that this could impact more than just the specific device record you're modifying.