Can I use androiddeviceprovisioning.googleapis.com as a customer ?

pierrenichele
Level 1.5: Cupcake

Hello,

 

I have access to https://partner.android.com/zerotouch (or to the nice new portal 🙂) to manage which configuration I want to send to our devices. The account I use is "owner". I have created a project with Partner API in Google Cloud.

 

For now I try to query my device list with androiddeviceprovisioning.googleapis.com using OAuth 2.0 Playground with that URI : https://androiddeviceprovisioning.googleapis.com/v1/partners/my_company_ID/devices/*

But all I succeed is to have an access denied :

{
 
"error": {
   
"status": "PERMISSION_DENIED",
   
"message": "Request had insufficient authentication scopes.",
   
"code": 403,
   
"details": [
     
{
       
"reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
       
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
       
"domain": "googleapis.com",
       
"metadata": {
         
"method": "google.android.device.provisioning.v1.DeviceProvisioningPartnerService.GetDevice",
         
"service": "androiddeviceprovisioning.googleapis.com"
       
}
     
}
   
]
 
}
}

 What am I missing ? Is that only possible for a customer (and not a resseller) to access devices with API ?

Thanks for you help.
Pierre from France

2 REPLIES 2

jasonbayton
Level 4.0: Ice Cream Sandwich

Hey! 

 

Check out the resource: 

 

 
There is no list in the resource for partners, but there are other queries you might be able to do to get what you're looking for?

pierrenichele
Level 1.5: Cupcake

I've made some progress \o/
Thanks to your link, I found the "Customer" section of the API documentation (I'm not very used to browse Google API Documentation 😅) :
https://developers.google.com/zero-touch/reference/customer/rest

Using that documentation, I successfully executed a query in C# with the provided code here :
https://developers.google.com/zero-touch/guides/customer/quickstart/dotnet

Afterwards, I attempted to modify the code to list my devices (instead of DPCs). However, despite repeated attempts, I failed to do so until I finally discovered that I needed to limit the results by providing a query parameter "pageSize" or a "nextPageToken" if the result exceeds a limit (which appears to be 100 devices).

I am more confortable with Powershell, so I attempted to achieve the same task in PowerShell. I successfully executed a query of my configurations with this URI:
https://androiddeviceprovisioning.googleapis.com/v1/customers/mucustomerID/devices?pageSize=100

Now I need to code a search tool to find a device in the list and a function to apply one of our MDM configurations to a device. However, now that I have the underlying logic, it should be easier. The concept of "nextPageToken" still remains mysterious for now. I need to investigate how to query all my devices and not just 100 of them. I will share my findings here once I have more time to investigate further.

Have a nice day,
Pierre from France