Skip to main content
Question

API Call Syntax error


Forum|alt.badge.img+3
  • New Contributor
  • 3 replies

Question? Has Jamf changed his Classic API Syntax? 

Example: When making a simple get Command using the following syntax 

curl -su example:exmaple -H "accept: text/xml" https://example.jamfcloud.com/JSSResource/computers/

I get the following error message: 

<title>Status page</title>

</head>

<body style="font-family: sans-serif;">

<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Unauthorized</p>

<p>The request requires user authentication</p>

<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">here</a>.<br>

Please continue your visit at our <a href="/">home page</a>.

</p>

</body>

</html>%                        

However if I just cut and past from the try this out I notice that url now has a bearer token attached to the end.

Example curl -X 'GET' \\ 'https://example.jamfcloud.com/JSSResource/computers' \\ -H 'accept: application/xml'

I don't see the deference!? ¯\\_(ツ)_/¯

 

3 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • January 14, 2025

@dywane Basic Auth is no longer supported for calling the Classic API and you will need to use Bearer Token auth instead. See this article from @talkingmoose for more details: https://community.jamf.com/t5/tech-thoughts/how-to-convert-classic-api-scripts-to-use-bearer-token/ba-p/273910

You might also want to take a look at https://www.jamf.com/blog/understanding-jamf-pro-api-roles-and-clients/ which covers the newer API Roles and Clients mechanism.

 


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • January 25, 2025
sdagley wrote:

@dywane Basic Auth is no longer supported for calling the Classic API and you will need to use Bearer Token auth instead. See this article from @talkingmoose for more details: https://community.jamf.com/t5/tech-thoughts/how-to-convert-classic-api-scripts-to-use-bearer-token/ba-p/273910

You might also want to take a look at https://www.jamf.com/blog/understanding-jamf-pro-api-roles-and-clients/ which covers the newer API Roles and Clients mechanism.

 



@sdagley wrote:

@dywane Basic Auth is no longer supported for calling the Classic API and you will need to use Bearer Token auth instead. See this article from @talkingmoose for more details: https://community.jamf.com/t5/tech-thoughts/how-to-convert-classic-api-scripts-to-use-bearer-token/ba-p/273910

You might also want to take a look at https://www.jamf.com/blog/understanding-jamf-pro-api-roles-and-clients/ which covers the newer API Roles and Clients mechanism.


Thanks for solving the syntax error. I also face this issue.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 3 replies
  • January 28, 2025
sdagley wrote:

@dywane Basic Auth is no longer supported for calling the Classic API and you will need to use Bearer Token auth instead. See this article from @talkingmoose for more details: https://community.jamf.com/t5/tech-thoughts/how-to-convert-classic-api-scripts-to-use-bearer-token/ba-p/273910

You might also want to take a look at https://www.jamf.com/blog/understanding-jamf-pro-api-roles-and-clients/ which covers the newer API Roles and Clients mechanism.

 


Thank you! This answer explains a lot! However, now Im getting the following error message.

{

"httpStatus" : 401

"error": [] 

}

Does this error mean I have to set password policy on the Jamf instance?


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