Can't register Client-Side Limitations of policy via API?

Yamashiro
New Contributor III

Hello,All.
I have specified the Client-Side Limitations of policy as follows.
However, it could not be registered.

After registering Client - Side Limitations on the screen, I can get setting information via API.

Is it impossible to register Client-Side Limitations via API?

curl -s -u 'username:password' -H 'accept: application/xml' -T policy.xml -X PUT https://exampledomain/JSSResource/policies/id/144

policy.xml

<?xml version="1.0" encoding="UTF-8"?>
<policy>
  <general>
    <id>144</id>
...
    <date_time_limitations>
      <activation_date/>
      <activation_date_epoch>0</activation_date_epoch>
      <activation_date_utc/>
      <expiration_date/>
      <expiration_date_epoch>0</expiration_date_epoch>
      <expiration_date_utc/>
      <no_execute_on/>
      <no_execute_start>4:00 AM</no_execute_start>
      <no_execute_end>6:00 AM</no_execute_end>
    </date_time_limitations>
...
</policy>
9 REPLIES 9

davidacland
Honored Contributor II
Honored Contributor II

The XML looks ok. You might want to try -H "Content-type: application/xml" rather than accept: application/xml.

If you try and run the PUT command manually in the terminal you should get some error information back telling you what's wrong.

mm2270
Legendary Contributor II

As @davidacland mentioned, you should try running the command in Terminal to see what it comes back with, but I suggest removing the -s flag so you get something back from curl, instead of silencing its output.

Yamashiro
New Contributor III

Thank you so much. @davidacland @mm2270

I tried running command with -H "Content-type: application/xml" option, and the following response was returned.

<?xml version="1.0" encoding="UTF-8"?><policy><id>144</id></policy>

But Client - Side Limitations of policy was not registered.

davidacland
Honored Contributor II
Honored Contributor II

What response do you get from: curl -u 'username:password' -H 'Content-type: application/xml' -T policy.xml -X PUT https://exampledomain/JSSResource/policies/id/144?

mm2270
Legendary Contributor II

@Yamashiro The response you posted is what you get back when the XML is successfully uploaded. Meaning, it's saying it worked. If that's what you got and the Client Side Limitations were not set in the policy, then it's possible there isn't a way to set them using the API. That would be odd, but not out of the question.

If I can, I will try to run a test on a junk policy to see if I can reproduce the issue. Just out of curiosity, what version of Jamf Pro is this being tested on?

mm2270
Legendary Contributor II

@Yamashiro, I did some quick tests with this, and I'm seeing the same issue. I enabled some basic client side limitations, to just tell it what times not to run the policy. Never touched the dates or anything else. I pulled down an xml of the policy afterwards and see the changes in the relevant section. I then flipped the settings back off in the policy in the UI to blank and saved. I then used the same XML file that I just pulled down with the changes in it to upload back to the server, and it shows it uploading the change after the PUT command, but going back into the UI, I don't see the changes take effect. It's still blank.

Seems like there's either some bug there preventing the changes from taking effect, or we're doing something wrong. If something else needs to be enabled/changed in the XML, then it's not very apparent what it is. You might want to check in with Jamf on this to see if they have a recommendation or can tell you what's going on.

psmac
New Contributor III
New Contributor III

I ran in to this last week and have an open call with Jamf support that has been passed to engineering, so hopefully is on Jamf’s radar now.

Yamashiro
New Contributor III

Thank you very much, @mm2270 @davidacland @psmac

Our jamf Pro version is 10.8.0.
I would like to report this problem.

psmac
New Contributor III
New Contributor III

@Yamashiro You can reference my case number when you log your support if it helps, the reference i’ve got is #: JAMF-0606575

The more people who mention it, the quicker it might get fixed!