FileMaker 16 > Jamf Rest API assistance

bvondeylen
Contributor II

I have a FileMaker Pro Server 16 setup (which is suppose to support REST API).
I have a cloud version of JAMF Pro.

I would like to use REST to GET mobileapplications data from the JSS to FileMaker.

Has anyone done this? I am hoping to learn, but it is going slow. I can see how to get the JSON data from the JSS https://myserver.com/api but I cannot figure out how to do this within FileMaker.

Anyone want to assist?

11 REPLIES 11

eDooku
New Contributor III

This depends heavily on exactly what you are trying to accomplish. Haven't really used FMP since version 12, but data in a database should still be structured the same way, and FMP is able to do a lot with its scripting engine.

Import JSS "mobileapplications" data into an FMP table? Get XML from JSS and use FMP's XML import with XSLT. You will need to transform JSS' XML result into a FMPXMLRESULT. Not very difficult, but you'll need some XSLT knowledge. I used trial and error with FileMaker Pro 7, and it worked well in the end. This will also work with FMP both on Mac and Windows.

Import JSS data for a given mobile device into a given record in FMP? Get FMP to fetch JSON data into a field, and process the field using FMPs built-in JSON commands. Don't know if FMP 16 has gained the ability to fetch an authenticated URL into a field, but it should be possible, at least as an external script. External scripting will be bound to the platform you run FMP on.

Don't remember if you can make FMP store the needed login info to do the REST calls, but in theory it should work. I would look into XML import and XSL transformation.

bvondeylen
Contributor II

Please look into the JSON. FileMaker 16 is suppose to support both JSON and XML content both ways. It is suppose to support tokens for authentication as well. Just need to get the cURL information correct for headers for FMP to GET data from the JSS (and eventually PUT).

I am just looking to GET /mobileapplication data right now. Once I see that working, I should be able to get the rest.

thank you

bvondeylen
Contributor II

I finally figured out how to send the authentication credentials and get a response for mobile applications. Now need to figure out how to parse through the response and put the individual pieces into fields and create new records for each entry.

I will post my Filemaker database when I have succeeded so others can experiment as well.

eDooku
New Contributor III

I stand corrected. You can absolutely use JSON calls directly in FMP scripts, and it seems nice. Just read https://fmhelp.filemaker.com/help/16/fmp/en/index.html#page/FMP_Help/json-functions.html and it seems you'll get there in the end.

Good luck!

bvondeylen
Contributor II

I got it! I now have a FileMaker Database where I have imported data via JSON API from my JSS to FileMaker.

MobileDevices took quite a long time to import (about 1 hour to import 2701 devices (iPads, iPhones).
MobileDeviceApplications went much quicker. Took about 2 minutes to import 1165 apps.

That was with the simple GET commands for each.

Now going to work on the IDs of each /mobiledeviceapplications/id/
which should give me more information on each app (including scope for each app!).

and /mobiledevices/id/
which should give me more information on each device

Then the next step is to experiment with the PUT and update information.

I can then use this Filemaker database which is already connected to our SIS (Infinite Campus) to update our JSS when new students arrive (or leave). I am getting excited with the possibilities :-)

joelande
Contributor

I hope you share your database when done, or close to done. Id' like to take a look at that.

bvondeylen
Contributor II

Well, I have the GET JSON working. Just cannot get the PUT XML to work.

Attached is the FileMaker 16 database for anyone to try.

I only have scripts to GET Mobile Devices and Mobile Device Applications (and only those fields I am interested in).

If anyone can get the PUT to work, I would love to know how you did it. Only way I can see to attach is to share the link to the database from my Google Drive folder. So hopefully it works.

API.fmp12

bvondeylen
Contributor II

I should mention that database uses 2 passes to get the information into each table.

Mobile Devices
First imports Mobile Devices ID, Display_Name, and Serial_Number
Second imports the rest of the data.

Mobile Device Applications
First imports Mobile Device Application ID, Bundle_ID, Display_Name, Version
Second imports the rest of the data

Of course, you need to fill in your data at the main menu (JSS, Username, Password)

bvondeylen
Contributor II

I have a FileMaker database successfully built which will GET data from the JSS and create records in FileMaker. You can then edit the data in FileMaker and PUT it back up to the JSS.

The great thing about using FileMaker is you don't have to export into CSV file. You can directly connect to the JSS via JSON or XML for GET and XML for PUT. FileMaker 16 has the capability.

The FileMaker database I built only deals with Mobile Devices and Mobile Device Applications (since that is all I needed), but looking at the scripts, tables could be expanded to include computers and all the data for computers as well.

Working in FileMaker is MUCH faster than working within the JSS. Example, I can take a classroom set of iPads and change the fields for Building, Room, Department, Site, and Device_Name and change them in FileMaker, press a button and a minute later the entire classroom set of iPads have been updated with the new data (similar to JSS MUT, but I don't need to create separate CSV files, and my data is re-usable and searchable and I can print reports, etc since it is in FileMaker Pro).

I will be posting my database later this week. Still need to clean up some things.

bvondeylen
Contributor II

I have a FileMaker Pro 16 database I am willing to share, that uses the jamf pro API.

Currently, I have the API create records in the FileMaker Pro 16 database using the GET API for Mobile Devices (inventory of iOS and tvOS devices) and Mobile Device Applications. Those are the only 2 tables I was concerned about.

In Mobile Devices, I collect the following fields (GET using JSON):
JSS ID
Display_Name
Serial_Number
iOS_Version
Asset_Number
Site_Name
UserName
Real_Name
Email_Address
Department
Building
Room

I am then able to modify records and send data back to the JSS from FMP using the API PUT (and POST for Display_Name). I can update multiple records with multiple fields at the same time (similar to JSS MUT, except multiple fields instead of one field at a time).

The following Fields can put updated back to the JSS from FMP (using PUT [or POST] using XML):
Display_Name (using POST)
Site
Username
Real_Name
Email_Address
Department
Building
Room

For Mobile Device Applications, I am creating records in FMP from JSS with the following fields using GET and JSON:
JSS_ID
Display_Name
iTunes_url
Description
Category
Deployment_Type
Total_VPP_Licenses
Used_VPP_Licenses
Remaing_VPP_Licenses

And I am able to update the JSS from FMP (PUT using XML) from the fields Category and/or Deployment_Type

If anyone would like this database to expand or look to see how it is done, send me an email (bvondeylen@neenah.k12.wi.us).

It wouldn't be difficult to expand upon what I have done with other tables (for computers) or collect more fields in the tables I have done.

Would you still have the database?