Previous topic

VPP License Operations

Next topic

Worker Threads

This Page

VPP Client

The main VPP API wrapper class

class commandment.vpp.vpp.VPP(stoken: str, vpp_service_config_url: str = 'https://vpp.itunes.apple.com/WebObjects/MZFinance.woa/wa/VPPServiceConfigSrv', service_config: dict = None)[source]

VPP Object. The main VPP API wrapper class.

AssociationProperties

Mapping of the LicenseAssociationType enum to the expected JSON keys in the request.

Type:dict
DisassociationProperties

Mapping of the LicenseDisassociationType enum to the expected JSON keys in the request.

Type:dict
assets(include_license_counts: bool = True, facilitator_member_id: str = None) → List[dict][source]

Get assets for which the organization has licenses.

Parameters:
  • include_license_counts (bool) – Include counts of total/assigned/unassigned licenses.
  • facilitator_member_id – Currently unused
Returns:

List of VPP assets for which this organization has licenses.

Return type:

List[dict]

bulk_update_licenses(adam_id: int, association_type: Optional[commandment.vpp.enum.LicenseAssociationType] = None, associate: Optional[List[str]] = None, disassociation_type: Optional[commandment.vpp.enum.LicenseDisassociationType] = None, disassociate: Optional[List[str]] = None, pricing_param: str = 'STDQ', notify: bool = False) → dict[source]

Perform a batch operation of license associations and disassociations.

Parameters:
  • adam_id (int) – Adam ID - The iTunes Store Product for which licenses will be managed.
  • association_type (Optional[LicenseAssociationType]) – Provide an association type if associate length > 0
  • associate (Optional[List[str]]) – A list of values that will be used to associate licenses, corresponding to the association_type
  • disassociation_type (Optional[LicenseDisassociationType]) – Provide a disassociation type if disassociate length > 0.
  • disassociate (Optional[List[str]]) – A list of values that will be used to disassociate licenses, corresponding to the association_type
  • pricing_param (str) – Defaults to Standard Quality ‘STDQ’
  • notify (bool) – Notify disassociation, default is False

See also

  • manageVPPLicensesByAdamIdSrv
edit_user(client_user_id: str = None, facilitator_member_id: str = None, email: str = None, managed_apple_id: str = None, user_id: str = None)[source]

Edit a user’s VPP record.

Parameters:
  • client_user_id (str) – A unique string, usually a UUID to identify the user in the MDM. You can use this OR the user_id to identify the user.
  • facilitator_member_id – Currently unused
  • email (str) – Supply an E-mail address to update the current address.
  • user_id (int) – User ID which uniquely identifies the user with the iTunes store.
  • managed_apple_id (str) – Managed Apple ID
Returns:

Containing the reply from the service.

Return type:

dict

get_user(client_user_id: str = None, its_id_hash: str = None, facilitator_member_id: str = None, user_id: int = None)[source]

Get the status of a user by their unique ID.

Parameters:
  • client_user_id (str) – A unique string, usually a UUID to identify the user in the MDM. You can use this OR the user_id to identify the user.
  • its_id_hash (str) – (Optional) iTunes Store ID hash
  • facilitator_member_id
  • user_id (int) – User ID which uniquely identifies the user with the iTunes store.
Returns:

Containing the reply from the service.

Return type:

dict

licenses(adam_id: int = None, pricing_param: Optional[commandment.vpp.enum.VPPPricingParam] = None, assigned_only: bool = False, facilitator_member_id: str = None, batch_token: str = None, since_modified_token: str = None) → commandment.vpp.vpp.VPPLicenseCursor[source]

Retrieve a list of licenses matching the supplied criteria.

Parameters:
  • adam_id (int) – Get licenses that match this Adam ID
  • pricing_param (Optional[VPPPricingParam]) – Get licenses that match this ‘Quality’ param.
  • assigned_only (bool) – Return only licenses that are assigned to users, if this value is true.
  • facilitator_member_id (str) – Currently unused
  • batch_token (str) – Supplied if there are more results to fetch.
  • since_modified_token (str) – Supplied if you want to fetch results modified since a certain date. This will be supplied on the last page of your most recent set of results.
Returns:

A cursor that can be used to fetch all remaining results, pre-populated with the first

page.

Return type:

VPPLicenseCursor

manage(adam_id: int, pricing_param: str = 'STDQ') → commandment.vpp.vpp.VPPLicenseOperation[source]

Manage VPP licenses for the given Adam ID.

Parameters:
  • adam_id (str) – The Adam ID
  • pricing_param (str) – The pricing param defaults to ‘STDQ’ but may be ‘PLUS’ for things which aren’t
  • software.
Returns:

an instance of a VPP license operation which can be modified to add or remove devices, and then submitted.

Return type:

VPPLicenseOperation

manage_device_licenses(adam_id: int, pricing_param: str = 'STDQ') → commandment.vpp.vpp.VPPDeviceLicenseOperation[source]

Manage VPP Device License Assignment.

Parameters:
  • adam_id (str) – The Adam ID
  • pricing_param (str) – The pricing param defaults to ‘STDQ’ but may be ‘PLUS’ for things which aren’t
  • software.
Returns:

an instance of a VPP license operation which can be modified to add or remove

license associations by device serial number

Return type:

VPPDeviceLicenseOperation

manage_user_licenses(adam_id: int, pricing_param: str = 'STDQ') → commandment.vpp.vpp.VPPUserLicenseOperation[source]

Manage VPP User License Assignment.

Parameters:
  • adam_id (str) – The Adam ID
  • pricing_param (str) – The pricing param defaults to ‘STDQ’ but may be ‘PLUS’ for things which aren’t
  • software.
Returns:

an instance of a VPP license operation which can be modified to add or remove license

associations by user client id

Return type:

VPPUserLicenseOperation

register_user(client_user_id: str, email: str = None, facilitator_member_id: str = None, managed_apple_id: str = None)[source]

Register an MDM user with VPP.

Parameters:
  • client_user_id (str) – A unique string, usually a UUID to identify the user in the MDM.
  • email (str) – The e-mail address of the user.
  • facilitator_member_id (str) – Currently unused
  • managed_apple_id (str) – Currently unused
Returns:

Containing the decoded body of the reply from the VPP service, eg:

{ "status": 0,
    "user": {
      "userId": 2878111686099947,
      "email": "vpp-test@localhost",
      "status": "Registered",
      "inviteUrl": "http://localhost:8080/D1971F9DD5F8E67BDD",
      "inviteCode": "D1971F9DD5F8E67BDD",
      "clientUserIdStr": "F33D9E0F-CDE3-427E-A444-B137BEF9EFA2"
    }
}

Return type:

dict

retire_user(client_user_id: str = None, facilitator_member_id: str = None, user_id: str = None)[source]

Unregister a user from VPP.

Parameters:
  • client_user_id (str) – A unique string, usually a UUID to identify the user in the MDM. You can use this OR the user_id to identify the user.
  • facilitator_member_id – Currently unused
  • user_id (int) – User ID which uniquely identifies the user with the iTunes store.
Returns:

Containing the reply from the service.

Return type:

dict

save(operation: commandment.vpp.vpp.VPPLicenseOperation, notify: bool = False) → dict[source]

Execute a license management operation, represented by a VPPLicenseOperation or subclass.

This provides a more convenient interface than bulk_update_licenses.

Parameters:
  • operation (VPPLicenseOperation) – The license operation to perform.
  • notify (bool) – Optional. Notify devices of license disassociation.
Returns:

Reply from the license endpoint.

Return type:

dict

users(include_retired: int = 1, facilitator_member_id: str = None, batch_token: str = None, since_modified_token: str = None) → commandment.vpp.vpp.VPPUserCursor[source]
Parameters:
  • include_retired (int) – 0 - do not include retired users, 1 - include retired users
  • facilitator_member_id – Currently unused
  • batch_token (str) – Batch token (if being called from a cursor)
  • since_modified_token (str) – Since modified token (if requesting a time delta)

Returns: