Skip to content
Graham R Pugh edited this page Mar 15, 2019 · 6 revisions

I'm getting an error saying that there is no requests module. What do I do?

If you're setting up JSSImporter for the first time, you might see a message like [ERROR] ImportError: No module named requests the first time you run a JSS recipe. The error message means that the requests module is not found on the Mac running a version of JSSImporter that requires it. You can install requests with pip:

sudo pip install requests

If your Mac doesn't have pip installed, it can be installed with easy_install:

sudo easy_install pip

Can I create the API user using the API?

Yes you can!

The required template is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<account>
  <name>AutoPkg</name>
  <password>%JSS_AUTOPKG_PASSWORD%</password>
  <directory_user>false</directory_user>
  <full_name>AutoPkg JSSImporter</full_name>
  <email>%EMAIL_ADDRESS%</email>
  <email_address>%EMAIL_ADDRESS%</email_address>
  <enabled>Enabled</enabled>
  <force_password_change>false</force_password_change>
  <access_level>Full Access</access_level>
  <privilege_set>Custom</privilege_set>
  <privileges>
    <jss_objects>
      <privilege/>
      <privilege>Create Categories</privilege>
      <privilege>Read Categories</privilege>
      <privilege>Update Categories</privilege>
      <privilege>Create Computer Extension Attributes</privilege>
      <privilege>Read Computer Extension Attributes</privilege>
      <privilege>Update Computer Extension Attributes</privilege>
      <privilege>Read Distribution Points</privilege>
      <privilege>Create Packages</privilege>
      <privilege>Read Packages</privilege>
      <privilege>Update Packages</privilege>
      <privilege>Create Policies</privilege>
      <privilege>Read Policies</privilege>
      <privilege>Update Policies</privilege>
      <privilege>Create Scripts</privilege>
      <privilege>Read Scripts</privilege>
      <privilege>Update Scripts</privilege>
      <privilege>Create Smart Computer Groups</privilege>
      <privilege>Read Smart Computer Groups</privilege>
      <privilege>Update Smart Computer Groups</privilege>
      <privilege>Create Static Computer Groups</privilege>
      <privilege>Read Static Computer Groups</privilege>
      <privilege>Update Static Computer Groups</privilege>
    </jss_objects>
    <jss_settings/>
    <jss_actions/>
    <recon/>
    <casper_admin/>
    <casper_remote/>
    <casper_imaging/>
  </privileges>
</account>

Substitute the values for %JSS_AUTOPKG_PASSWORD% and %EMAIL_ADDRESS% with real values.

To upload the XML template and create the user from the terminal, use the following command:

curl -s -k -i -H "Content-Type: application/xml" \
   -d @"%PATH_TO_ABOVE_XML_TEMPLATE%" \
   --user "%JSSADMINUSER%:%JSSADMINPWD%" \
   "%JSS_URL%/JSSResource/accounts/userid/0"

Substitute the values for %PATH_TO_ABOVE_XML_TEMPLATE%, %JSSADMINUSER%, %JSSADMINPWD% and %JSS_URL% with real values.

Clone this wiki locally