Creating Mobile Device PreStage through Jamf Pro api

knalbers
New Contributor

I swear I'm about to pull out all my hair. I am able to send the following JSON to Jamf.

{
    "displayName": "test prestage delete this",
    "isMandatory": true,
    "isMdmRemovable": false,
    "supportPhoneNumber": "",
    "supportEmailAddress": "",
    "department": "",
    "isDefaultPrestage": false,
    "enrollmentSiteId": "97",
    "isKeepExistingSiteMembership":false,
    "isKeepExistingLocationInformation": false,
    "isRequireAuthentication": false,
    "authenticationPrompt": "",
    "deviceEnrollmentProgramInstanceId": "104",
    "skipSetupItems": {
      "Biometric": true,
      "SoftwareUpdate": false,
      "Diagnostics": true,
      "iMessageAndFaceTime": true,
      "TVRoom": false,
      "Passcode": true,
      "SIMSetup": true,
      "ScreenTime": true,
      "RestoreCompleted": true,
      "TVProviderSignIn": false,
      "Siri": true,
      "Restore": true,
      "ScreenSaver": false,
      "HomeButtonSensitivity": true,
      "CloudStorage": true,
      "Privacy": true,
      "TransferData": true,
      "Zoom": true,
      "PreferredLanguage": true,
      "TVHomeScreenSync": false,
      "ExpressLanguage": true,
      "AppleID": true,
      "DisplayTone": true,
      "WatchMigration": true,
      "UpdateCompleted": true,
      "Appearance": true,
      "Android": true,
      "Payment": true,
      "OnBoarding": true,
      "TOS": true,
      "Welcome": true,
      "TapToSetup": false,
      "Location": false
      },
    "locationInformation": {
      "username": "",
      "realname": "",
      "phone": "",
      "email": "",
      "room": "",
      "position": "",
      "departmentId": "-1",
      "buildingId": "-1",
      "id": "-1",
      "versionLock": 1
    },
    "purchasingInformation": {
    "id": "-1",
    "isLeased": false,
    "isPurchased": true,
    "appleCareID": "",
    "poNumber": "",
    "vendor": "",
    "purchasePrice": "",
    "lifeExpectancy": 0,
    "purchasingAccount": "",
    "purchasingContact": "",
    "leaseDate": "1970-01-01",
    "poDate": "1970-01-01",
    "warrantyDate": "1970-01-01",
    "versionLock": 1
    },
    "anchorCertificates": [],
    "enrollmentCustomizationId": "0",
    "language": "en",
    "region": "US",
    "isPreventActivationLock": true,
    "isEnableDeviceBasedActivationLock": false,
    "isAutoAdvanceSetup": false,
    "isAllowPairing": true,
    "isMultiUser": false,
    "isSupervised": true,
    "maximumSharedAccounts": 10,
    "isConfigureDeviceBeforeSetupAssistant": true,
    "names": {
      "assignNamesUsing": "Serial Numbers",
      "prestageDeviceNames": [],
      "deviceNamePrefix": "PRE-",
      "deviceNameSuffix": "-SUF",
      "singleDeviceName": "",
      "isManageNames": true,
      "isDeviceNamingConfigured": true
    }
  }

The server happily responds with a 201 response and the id of the "created" prestage but it never actually gets created. Attempting to GET the id results in a 404 and doesn't ever show up in the web interface.

Anyone have any ideas?

5 REPLIES 5

SamF
Contributor II
Contributor II

What version of Jamf Pro are you running? After modifying the values for enrollmentSiteId and deviceEnrollmentProgramInstanceId to fit my environment, I was able to use the exact same request body you posted without any issues on v10.21, but I believe there may have been some changes to the API in the more recent releases.

knalbers
New Contributor

Yeah, you're right. The prestages were getting created for me as well, but they were being placed at the root of the server where my account doesn't have access. The global admin looked and was able to see all the prestages I created.

He tried looking for a way to cause them to show up for my site but they seem to appear identical to the prestages that are being created through the web interface.

SamF
Contributor II
Contributor II

Interesting. So, your account is only privileged for access to specific site(s)? The GUI prevents creation of Prestages for site based Jamf Pro user accounts. If the API is allowing this, I suspect that would be considered a product issue.

knalbers
New Contributor

Weird. I can create prestages for my site through the API and through the web interface.

knalbers
New Contributor

In case anyone ever digs this up, my (disgusting) workaround was to clone-save-repeat a uniquely named prestage a bunch of times, find all of those prestages, and then rename them.