Skip to main content
Question

API Question


rstasel
Forum|alt.badge.img+13
  • Valued Contributor
  • 334 replies

Hi All,

I'm trying to use the JSS API, and I can't seem to find documentation on how or if it works if your JSS is broken into sites, and you only have read/write to a specific site.

Our campus has a central Casper server, and I only have access to my specific site... but I'm not sure if the API is smart enough to actually drop my posted data into my site, or if the reason I'm getting "Conflict" (Error 409's) back is because it's saying I don't have rights to create content in the root of the JSS.

Here's what I'm trying:

curl -skfu username:password https://casper.example.com:8443/JSSResource/computergroups/id/0 -T ~/Desktop/macOSSierraIncompatible.xml -X POST;

content of that xml is from here: https://derflounder.wordpress.com/2016/09/20/building-a-casper-smart-group-containing-sierra-incompatible-macs/#more-8325

Help?

10 replies

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • January 9, 2017

Do you have permission to create a smart group? Can you do it in the GUI? That process should work. I have had issues in the past where if my 'site' is not set in the JSS to the one I have write access to, the API call will fail. Perhaps open the web browser, make sure your site is set properly, test creating a smart group, then try the API run again...


Forum|alt.badge.img+21
  • Valued Contributor
  • 275 replies
  • January 9, 2017

Thanks for the link! That worked for me out of the box, but we're not using sites. I think your suspicion is correct.


rstasel
Forum|alt.badge.img+13
  • Author
  • Valued Contributor
  • 334 replies
  • January 9, 2017

I do have permissions to create smart groups within my site, not within the full JSS.


rstasel
Forum|alt.badge.img+13
  • Author
  • Valued Contributor
  • 334 replies
  • January 16, 2017

Any other ideas on this, or options for more troubleshooting?


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • 1901 replies
  • January 16, 2017

I personally haven't tried creating a smart computer group within a site when I only have access to the site. See if adding the site after the the is_smart element helps.

<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
  <name>Macs incompatible with macOS Sierra</name>
  <is_smart>true</is_smart>
  <site>
     <name>Site Name</name>
  </site>
  <criteria>
    <size>37</size>
...

rstasel
Forum|alt.badge.img+13
  • Author
  • Valued Contributor
  • 334 replies
  • January 16, 2017

!!!

That worked!!!

Thank you! Totally need to document this somewhere. =)


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • 1901 replies
  • January 16, 2017

Glad that helped.

You'd see the site element in the XML if you were logged in to the full JSS or a member of a group with access to more than just one site. For other JSS objects you need to create, remember it'll appear in about the same location (just below the type of element you're creating).


talkingmoose
Forum|alt.badge.img+36
  • Community Manager
  • 1901 replies
  • January 17, 2017

Glad that helped.

You'd see the site element in the XML if you were logged in to the full JSS or a member of a group with access to more than just one site. For other JSS objects you need to create, just remember it'll appear in about the same location (just below the type of element you're creating).


Forum|alt.badge.img+9
  • Contributor
  • 20 replies
  • March 28, 2017

By the way, this smart group has 37 criteria and caused us some problems months down the road. Apparently it's not a good idea to make smart groups that are so difficult to calculate...


Forum|alt.badge.img+9
  • Contributor
  • 20 replies
  • March 28, 2017

By the way, this smart group has 37 criteria and caused us some problems months down the road. Apparently it's not a good idea to make smart groups that are so difficult to calculate...


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings