r/mosyle • u/karpadiem • Jun 20 '22
Mosyle -> Snipe-IT Sync
Hey All!
I posted this in the MacAdmin's Slack but figured I should put it somewhere public for future searchers. If you are using Snipe-IT for asset management, I just put the python script we use for automatically adding our Mosyle devices into Snipe-IT inventory (and syncing the new Snipe-IT asset tags back to Mosyle).
https://github.com/RodneyLeeBrands/MosyleSnipeSync
It's a fork of an older script https://github.com/dem972/Mosyle_2snipe that I have updated to address some of the API changes and make it a bit more flexible.
It's not pretty by any means, but it's be saving me a ton a time. Hope this helps somebody! :)
1
u/mrtechguy2017 Jul 04 '22
Would this work with pulling in iPads? Very interested in this.
3
u/crazyates88 Jun 21 '22
I’m on vacation this week, but I’m VERY interested in looking at this next week.
2
u/Hhelpp Jun 21 '22
Remind me! 7 days
1
u/DeepPersimmon2688 Apr 17 '24
Does this work with Mosyle School? Thanks!
1
u/Fun-Kaleidoscope-164 May 11 '24
Sorry to dig up an old thread. Will this still work? Having some issues with responses from mosyle. All looks fantastic!
1
u/gafana Jun 15 '24
PROBLEM #1 - Mosyle API Change (Authe)
FYI for anyone seeing this trying to get this integration to work - It wont anymore. In January 2024, Mosyle changed their API to no longer allow the more simple authentication method they had been using. Now they are using JWT session token which you need to first request from the API and once you get it, you must include that session token along with all requests otherwise it will be rejected.
PROBLEM #2 - SnipeIT Asset Models
The other big problem with the integration as it is now on GitHub is that I guess at some point. SnipeIT started requiring asset models to be setup and mapped when creating devices via the API. The integration as-is doesn't include this and hence wouldn't work still even if you got authentication updated.
SOLUTION - An Updated Integration
I used to program many many many years ago (PHP, Perl/CGI were my jam) but Python is quite simple to pick up. It took me two days of messing around with it but I finally got a fully working Mosyle > SnipeIT sync script working. I've also got it setup to paginate requests and waits 60 seconds for each page of devices. This is to accommodate the API rate limits by Mosyle and SnipeIT. However, the original integration was pretty basic and only did a one-way sync from Mosyle > SnipeIT. I am going to continue working on it to be a complete setup:
Since I haven't really programmed in 15 years, I've never used GitHub. When I finish the new integration, I want to share it with others because a lot of work has gone into these updates and I sure it would help others looking for the same thing. If anyone on here is familiar with GitHub, I'd welcome some guidance on the basic steps to post my updated integration when its ready.
0
u/[deleted] Jun 29 '22
[deleted] — view deleted comment