API for Asset Tag

BND10706
New Contributor

I a building a custom mobile app for our team to be able to add a location based on the mobile devices asset tag.

I have looked at the api, and I have found a way to update the location of a device using the serial number.

Is there a way, beside doing a loop through each device to set a location based on a mobile devices asset tag?

There will basically be 2 fields to this app, one where an asset tag is put in, and one where the location will be put in.

3 REPLIES 3

Tribruin
Valued Contributor II

You will need to search for the Asset Tag, get the Mobile Device ID from the result, and then use ID update the Location using the ID:

<<Jamf_URL>>/JSSResource/mobiledevices/match/<<ASSET_TAG>> will return the mobile device with that tag (assuming there is one). Grab the ID and then use /JSSResource/mobiledevice/id/<<ID>> to PUT the location.

BND10706
New Contributor

@RBlount So when i do the Put... is it going in as a JSON? This is an iOS application and it does not seem to take in the JSON object.

Tribruin
Valued Contributor II

@BND10706 , not JSON, has to be XML for the classic API (which this call uses). Try using this XML:

'<mobile_device><general><asset_tag>12345</asset_tag></general></mobile_device>'