Skip to main content
Question

Creating new mobiledeviceprofile with API


tobiaslinder
Forum|alt.badge.img+16

I try to create a new mobile device profile by running the command

curl -k -v -u apiuser:apiuserpassword -T nightblock.xml -X POST https://myjssurl:8443/JSSResource/mobiledeviceconfigurationprofiles/name/nightblock

with a xml-File with this content:

<?xml version="1.0" encoding="UTF-8"?> <configuration_profile> <general> <name>nightblock</name> <payloads> <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-............payloadcontent.................. </payloads> </general> </configuration_profile>

but I always get this output:

Trying 10.0.56.156... Connected to myjssurl (10.0.56.156) port 8443 (#0) TLS 1.1 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA Server certificate: myjssurl Server certificate: DigiCert SHA2 High Assurance Server CA Server certificate: DigiCert High Assurance EV Root CA Server auth using Basic with user 'apiuser' > POST /JSSResource/mobiledeviceconfigurationprofiles/name/Nachtfilter HTTP/1.1 > Host: jss.anykeyit.ch:8443 > Authorization: Basic YXBpdXNlcjpibGFibGE= > User-Agent: curl/7.43.0 > Accept: / > Content-Length: 2784 > Expect: 100-continue > < HTTP/1.1 100 Continue We are completely uploaded and fine < HTTP/1.1 500 Internal Server Error < X-FRAME-OPTIONS: SAMEORIGIN < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 < Date: Sun, 06 Sep 2015 22:02:59 GMT < Accept-Ranges: bytes < Server: Restlet-Framework/2.1.7 < Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept < Content-Type: text/html;charset=UTF-8 < Content-Length: 519 < Connection: close < <html> <head> <title>Status page</title> </head> <body style="font-family: sans-serif;"> <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Internal Server Error</p> <p>Couldn&apos;t read the XML representation. The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed.</p> <p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">here</a>.<br> Please continue your visit at our <a href="/">home page</a>. </p> </body> </html> * Closing connection 0

Does anyone have an idea what's wrong in my thought process? Thanks in advance for your help!

3 replies

Forum|alt.badge.img+16
  • Honored Contributor
  • 403 replies
  • September 6, 2015

You can't create a new JSS object via the API by the name url. You have to use the id number version of the url, and specify the ID as 0.

JSSResources/mobiledeviceconfigurationprofiles/id/0

The JSS will assign the object to the next available id # and name the object with what you put in the XML


tobiaslinder
Forum|alt.badge.img+16
  • Author
  • Valued Contributor
  • 101 replies
  • September 7, 2015

Hi Chris
Thanks for your input. I now tried it with this command

curl -k -v -u apiuser:apiuserpassword -T nightblock -X POST https://myjssurl:8443/JSSResource/mobiledeviceconfigurationprofiles/id/0

but I get again this message :-(

TLS 1.1 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA Server certificate: myjssurl Server certificate: DigiCert SHA2 High Assurance Server CA Server certificate: DigiCert High Assurance EV Root CA Server auth using Basic with user 'apiuser' > POST /JSSResource/mobiledeviceconfigurationprofiles/id/0 HTTP/1.1 > Host: jss.anykeyit.ch:8443 > Authorization: Basic YXBpdXNlcjpibGFibGE= > User-Agent: curl/7.43.0 > Accept: / > Content-Length: 2783 > Expect: 100-continue > < HTTP/1.1 100 Continue We are completely uploaded and fine < HTTP/1.1 500 Internal Server Error < X-FRAME-OPTIONS: SAMEORIGIN < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 < Date: Mon, 07 Sep 2015 10:27:48 GMT < Accept-Ranges: bytes < Server: Restlet-Framework/2.1.7 < Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept < Content-Type: text/html;charset=UTF-8 < Content-Length: 519 < Connection: close < <html> <head> <title>Status page</title> </head> <body style="font-family: sans-serif;"> <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Internal Server Error</p> <p>Couldn&apos;t read the XML representation. The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed.</p> <p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">here</a>.<br> Please continue your visit at our <a href="/">home page</a>. </p> </body> </html> * Closing connection 0

Forum|alt.badge.img+6
  • New Contributor
  • 9 replies
  • September 8, 2021
tobiaslinder wrote:

Hi Chris
Thanks for your input. I now tried it with this command

curl -k -v -u apiuser:apiuserpassword -T nightblock -X POST https://myjssurl:8443/JSSResource/mobiledeviceconfigurationprofiles/id/0

but I get again this message :-(

TLS 1.1 connection using TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA Server certificate: myjssurl Server certificate: DigiCert SHA2 High Assurance Server CA Server certificate: DigiCert High Assurance EV Root CA Server auth using Basic with user 'apiuser' > POST /JSSResource/mobiledeviceconfigurationprofiles/id/0 HTTP/1.1 > Host: jss.anykeyit.ch:8443 > Authorization: Basic YXBpdXNlcjpibGFibGE= > User-Agent: curl/7.43.0 > Accept: / > Content-Length: 2783 > Expect: 100-continue > < HTTP/1.1 100 Continue We are completely uploaded and fine < HTTP/1.1 500 Internal Server Error < X-FRAME-OPTIONS: SAMEORIGIN < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 < Date: Mon, 07 Sep 2015 10:27:48 GMT < Accept-Ranges: bytes < Server: Restlet-Framework/2.1.7 < Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept < Content-Type: text/html;charset=UTF-8 < Content-Length: 519 < Connection: close < <html> <head> <title>Status page</title> </head> <body style="font-family: sans-serif;"> <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Internal Server Error</p> <p>Couldn&apos;t read the XML representation. The processing instruction target matching &quot;[xX][mM][lL]&quot; is not allowed.</p> <p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">here</a>.<br> Please continue your visit at our <a href="/">home page</a>. </p> </body> </html> * Closing connection 0

Hi Tobiaslinder  :

I also have the same question ~ do you know the solution already?


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