vefneuro.blogg.se

Jamf api scripts
Jamf api scripts













jamf api scripts
  1. Jamf api scripts update#
  2. Jamf api scripts software#
  3. Jamf api scripts code#

In Python we will be using the “” library to working with the returned XML from the JSS. The “2>&1” for the Xpath command is redirrecting STDERR to STDOUT so we can suppress some of the verbose output from Xpath.

Jamf api scripts code#

If you want to get both the XML response as well as the status code in the same call, you will need to amend the above commands to include “–write-out user "$user:$pass" -H "Content-Type: text/xml" -X PUT -d $PUTxml user "$user:$pass" -H "Content-Type: text/xml" -X POST -d $POSTxmlĬurl. If you are using a variables instead of a file you will need to be careful that you have properly escaped double-quotes within the string. The variables below for the XML can be either XML string variables or files. Working with shell scripts you will be using the cURL command.

jamf api scripts

A 500 status code usually indicates something has gone wrong on the server end and is unrelated to your request. Check your XML and reattempt the request.ĥ00: This is a generic internal server error.

jamf api scripts

Normally this is due to your XML not including all of the required data, having invalid data or there is a conflict between what your resource and another one (e.g. Check the URL to the resource you are using.Ĥ09: There was a conflict when your request was processed. You will need to check the permissions of the account being used in the JSS interface under “System Settings > JSS User Accounts & Groups”.Ĥ04: The JSS could not find the resource you were requesting. Check your credentials or check how they are being processed/handled.Ĥ03: You have made a valid request, but you lack permissions to the object you are trying to interract with. You should recheck the request and/or XML and reattempt the request.Ĥ01: Your authentication for the request failed.

Jamf api scripts update#

The status code you receive can help you troubleshoot your API call and determine what is incorrect or needs to be changed.Ģ01: Your request to create or update an object was successful.Ĥ00: There was something wrong with your request. 2XX codes represent a successful response. Successful and failed API calls will return a variety of status codes. Understanding status codes for HTTP responses: A successful DELETE will return a status code of 200 and XML containing the ID of the object we deleted including the tag: “True”.

jamf api scripts

A successful PUT returns a status code of 201 and XML containing the ID of the object we updated.ĭELETE will delete a JSS object. PUT takes input XML from a variable or a file and updates a JSS object. A successful POST returns a status code of 201 and XML containing the ID of the object we just created, allowing us to further interact with it. POST takes input XML from a variable or a file and creates a new JSS object for a resource. A successful GET returns a status code of 200 and the XML of the requested resource/object. GET retrieves data from a JSS resource for us to parse. This will display the XML of any object in yours JSS for you to view and copy as you being to explore the API (Note: any use of the documentation page to view resources will require authentication).Īll of the interactions with the JSS REST API are done using HTTP methods. Especially useful on the documentation page is the “Try it out!” button for every GET example. The documentation page for your JSS contains a list of all of the available resources, their objects, the parameters those objects can use and what methods you can use to interact with them. To better follow along with this post check out your “JSS REST API Resource Documentation”: Lastly I’ll outline an example of using the API for performing a search and pulling out the data we want. Then there will be examples of making these calls for both Bash and Python that you can use as starting points. In the opening we’ll be covering some of the basics behind HTTP requests and responses.

Jamf api scripts software#

In this post I’m going to be exploring the JAMF Software Server (JSS) REST API.















Jamf api scripts