Using Postman and the JSS API

brandonusher
Contributor II

Hey there! I was having problems with the API, trying to figure out how to mass update device locations (really usernames for VPP assignments) and I finally figured out the solution.

I am using POSTMAN for Google Chrome (https://chrome.google.com/webstore/detail/postman-rest-client-packa/fhbjgbiflinjbdggehcddcbncdddomop). (To do what I am showcasing requires the "Pro" version of POSTMAN which costs $10). I assume you can do something similar with Powershell or Terminal (PC or Mac respectively), both of which are Free but would require some modifications to the below.

Step 1:

Create a CSV file with information, such as the following:

serialnumber, username, full_name, email
DLXH78GBDJ8R, brandonusher, Brandon Usher, someone@example.com

You need a space after each comma, otherwise POSTMAN may start complaining.

Save the CSV in a location you can find easily and name it appropriately.

Step 2: Setup an Environment.

Next to the eye near the top of the screen, click where it says "No environment" and select "Manage Environments".
Click "Add" and give this Environment a Name.
Where it says "Key" you can name this whatever you want, but I named mine "jssapiurl" without the quotes.
The value is as such: "https://jss.vcpusd.k12.ca.us:8443/JSSResource" without the quotes. (Chance to whatever your JSS URL is followed by /JSSResource).
Click Submit then close the small window.

Step 3: Fill out the request information.

The URL I am using is:

{{jssapiurl}}/mobiledevices/serialnumber/{{serialnumber}}

Select "PUT" from the dropdown next to the URL field

Click Headers to the right of the URL field and make two entries. One for Content-Type and the other for Accept. Make both values "application/xml" without the quotes.

To get the Authorization Header filled out, click "Basic Auth" at the top and put in your JSS username and password. Make sure the account has administrator access.

Click "raw" instead of "form-data".

Copy paste the following into the text field that just showed up:

<?xml version="1.0" encoding="utf-8"?>
<mobile_device>
  <location>
    <username>{{username}}</username>
    <real_name>{{full_name}}</real_name>
    <email_address>{{email}}</email_address>
  </location>
</mobile_device>

Here is a screenshot of my setup so far: http://i.imgur.com/TcqstcM.png

The two headers, Content-Type and Accept, can be changed to "application/json" if you prefer to send and receive JSON over XML.

Click "Add to collection" and make a new collection along with naming this request.

Step 4: Finally get to assigning devices to users

Now in the top left, click "Collection runner". This is where you need the "Pro" version of POSTMAN.

Choose the collection you just created under the Collection dropdown.

Choose the environment you made under Environment

Make Iterations whatever number you want. They say they don't have a limit yet, but they implement one later.

Delay is the amount of time you want it to wait between requests.

Click Choose File next to Data and select the CSV we made.

Choose CSV as the Data file type.

Click Start.

Hopefully this helped you out with the same issue I was having.

If you have any issues, feel free to reply here or email me at and I can try to help you out.

I am trying to adapt this into a Powershell script so that I can run it with Task Scheduler and to pull the information from the SQL Server that is holding all the assignments. If you would like me to post the script once I have it figured out, let me know.

2 REPLIES 2

jamflund
New Contributor III

This was posted long time ago. Can you make a new guide using PostMan application and with the current API for JamfPro?

Thanks a lot!

Ecco_Luke
Contributor II

I too would be very interested in an updated guide, for the reasons @jamflund mentioned above.