Adding a mobileDevicePreStage using REST API

calarcon
New Contributor II

We are trying to setup a mobileDevicePreStage using REST API but I am having the following issue:

We fist get the site, dep program.
We do not want to setup any locationInformation or purchasingInformation as when we create it from the web console.

But it always tells us we are missing some locationInformation & purchasingInformation properties we do not know were we must fetch them from:

message: '400 - {"httpStatus":400,"errors":[{"code":"FIELD_REQUIRED","description":"field is required","id":0,"field":"purchasingInformation.versionLock"},{"code":"FIELD_REQUIRED","description":"field is required","id":0,"field":"locationInformation.versionLock"},{"code":"FIELD_REQUIRED","description":"field is required","id":0,"field":"locationInformation.id"},{"code":"FIELD_REQUIRED","description":"field is required","id":0,"field":"purchasingInformation.id"}]}

When creating the preStage using web console seems the create some new location & purchasing info with empty data. This is the output of a GET /uapi/v1//v1/mobile-device-prestages/6

{ enrollmentSiteId: 1, id: 6, displayName: 'hmsch', supportPhoneNumber: '', supportEmailAddress: '', department: '', authenticationPrompt: '', profileUUID: '', deviceEnrollmentProgramInstanceId: 1, versionLock: 1, skipSetupItems: { Biometric: true, SoftwareUpdate: true, Diagnostics: true, iMessageAndFaceTime: true, TVRoom: true, Passcode: true, SIMSetup: true, ScreenTime: true, TVProviderSignIn: true, Siri: true, Restore: true, ScreenSaver: true, HomeButtonSensitivity: true, CloudStorage: true, Privacy: true, Zoom: true, TVHomeScreenSync: true, AppleID: true, DisplayTone: true, WatchMigration: true, Android: true, Payment: true, OnBoarding: true, TOS: true, TapToSetup: true, Location: false }, locationInformation: { username: '', realname: '', phone: '', email: '', room: '', position: '', departmentId: -1, buildingId: -1, id: 4, versionLock: 0 }, purchasingInformation: { id: 4, 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: 0 }, anchorCertificates: [], maximumSharedAccounts: 10, language: 'es', region: 'ES', siteId: 1, names: { assignNamesUsing: 'Default Names', prestageDeviceNames: [], deviceNamePrefix: '', deviceNameSuffix: '', isManageNames: false, isDeviceNamingConfigured: false }, isAutoAdvanceSetup: true, isEnableDeviceBasedActivationLock: false, isPreventActivationLock: true, isConfigureDeviceBeforeSetupAssistant: true, isAllowPairing: true, isSupervised: true, isMultiUser: false, isKeepExistingSiteMembership: false, isMdmRemovable: false, isMandatory: true, isRequireAuthentication: false, isKeepExistingLocationInformation: false, isDefaultPrestage: false }

2 REPLIES 2

calarcon
New Contributor II

Just in case it would help someone in slack (https://app.slack.com/team/U764304Q2) we got this answer and actually it worked:

{
  "displayName": "Example Mobile Prestage Name",
  "isMandatory": true,
  "isMdmRemovable": true,
  "supportPhoneNumber": "5555555555",
  "supportEmailAddress": "example@example.com",
  "department": "Oxbow",
  "isDefaultPrestage": false,
  "enrollmentSiteId": -1,
  "isKeepExistingSiteMembership": true,
  "isKeepExistingLocationInformation": true,
  "deviceEnrollmentProgramInstanceId": 1,
  "skipSetupItems": {},
  "locationInformation": {
      "id": 0,
    "username": "",
    "realname": "",
    "phone": "",
    "email": "",
    "room": "",
    "position": "",
    "departmentId": -1,
    "buildingId": -1,
    "versionLock": 0
  },
  "isAllowPairing": true,
  "isMultiUser": true,
  "isSupervised": true,
  "maximumSharedAccounts": 10,
  "isAutoAdvanceSetup": true,
  "isPreventActivationLock": true,
  "isEnableDeviceBasedActivationLock": true,
  "isConfigureDeviceBeforeSetupAssistant": true,
  "language": "en",
  "region": "US",
  "names": {
    "assignNamesUsing": "List of Names",
    "prestageDeviceNames": [
      {
        "id": 1,
        "deviceName": "iPad",
        "isUsed": false
      }
    ],
    "deviceNamePrefix": "prefix",
    "deviceNameSuffix": "suffix",
    "isManageNames": true,
    "isDeviceNamingConfigured": true
  },
  "purchasingInformation": {
      "id": 0,
    "isLeased": true,
    "isPurchased": true,
    "appleCareID": "",
    "poNumber": "",
    "vendor": "",
    "purchasePrice": "",
    "lifeExpectancy": 0,
    "purchasingAccount": "",
    "purchasingContact": "",
    "leaseDate": "1970-01-01",
    "poDate": "1970-01-01",
    "warrantyDate": "1970-01-01",
    "versionLock": 0
  }
}

syncron
New Contributor II
New Contributor II

@calarcon Thank-you for sharing, I needed to automate prestage creation en masse and this was very helpful!