1
votes

When doing this :

var results = AdminLicenseManager.LicenseAssignments
.update({userId: userId}, productId, skuId, userId);

I get this error.

GoogleJsonResponseException: skuId is required field

I have an issue understanding the "resource parameter" (first one) i guess.. but I am not sure.

vars are:

skuId = Google-Apps-Lite
userId = [email protected]
productId = Google-Apps
resource = {[email protected]}

thanks for your help..

1

1 Answers

1
votes

Per the API Reference, LicenseAssignments.update is used to "Reassign a user's product SKU with a different SKU in the same product."

Also on the reference page is the description of the required properties in the resource body: productId, skuId, and userId. These 3 values are the values that will be assigned to the LicenseAssignment identified by the "path" parameters. Note that only the skuId is writable.

const resource = {
  productId: ...,
  skuId: ...,
  userId: ...,
};
var oldProductId = ...;
var oldSkuId = ...;
var oldUserId = ...;
var updatedLicenseAssignment = AdminLicenseManager.LicenseAssignments
  .update(resource, oldProductId, oldSkuId, oldUserId);

Consider using .patch instead of .update if you prefer to only supply the new skuId.