Licenses API when switching between SKU's

145 views
Skip to first unread message

Ivan Boskovic

unread,
Mar 16, 2023, 3:28:17 PM3/16/23
to GAM for Google Workspace
Hi all,

I am trying to batch API call for user licenses changes.
The API call quota is 100 per minute, which is too low, but batching would be a solution around that I think, if possible, as I can't figure out how the command would look like.

I have a customer that is on Enterprise Plus, and I have to change all users to Enterprise Standard, then assign some users with Enterprise Standard Archive User licenses and some with Frontline Worker and Vault licenses.
As this would be a tedious job doing it one by one using standard command to switch from a CSV  file, I am looking if batching is possible here.

Standard command I can use is: 
gam csv C:\list.csv gam users ~Users update license 1010020030 from 1010020026

This would switch users from one SKU to another as needed, but it would be long and would be backing off exceeding quota a lot and would take long 

Is using batching "gam batch" possible for this at all?

I tried a few different commands but none work, like:

gam batch csv C:\list.csv gam users ~Email update license 1010020030 from 1010020026
for this command I get an error: ERROR: File: csv, [Errno 2] No such file or directory: 'csv'

gam csv C:\list.csv gam batch users ~Email update license 1010020030 from 1010020026
for this one I get: ERROR: File: users, [Errno 2] No such file or directory: 'users'

Anyone knows this or came across this?

Any response is appreciated greatly.

Thanks in advance!

Ross Scroggs

unread,
Mar 16, 2023, 7:52:27 PM3/16/23
to google-ap...@googlegroups.com
Ian,

There is no batching as you want. The gam batch command reads a file containing gam commands and executes them.

I'm assuming that C:\list.csv looks like this, is that correct?
Users
...

If so, then this command is what you want.
gam csv C:\list.csv gam users ~Users update license 1010020030 from 1010020026

What errors/problems are you seeing?

Ross


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c6239757-8a97-42a6-90f9-e2b1e065b2e0n%40googlegroups.com.


--

Ivan Boskovic

unread,
Mar 17, 2023, 3:56:33 AM3/17/23
to google-ap...@googlegroups.com
Hi Ross,

Yes, that would be correct.
I am doing that, but after the first about a hundred users the API quota gets in the way and it statts backing of for a bit before it continues.

The number of requests exceeding quota is the reason I see GAM showing me, which is expected really as the license API can't handle that many requests: https://developers.google.com/admin-sdk/licensing/v1/limits

I was wondering if it's possible to batch it in any way using GAMADV so they all go in a single request as per:
https://developers.google.com/admin-sdk/licensing/v1/how-tos/batch

If not that's OK, just want to know so I am not chasing ghosts around :)

Thank you for your help on this Ross!

You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/6_dlHTrA18E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAJkvRS9iRpwhzRpd%3DZKnUH_242knP3F--iQN%2B_0a-sAhbtCnVQ%40mail.gmail.com.

Ivan Boskovic

unread,
Mar 17, 2023, 4:06:43 AM3/17/23
to google-ap...@googlegroups.com
Just to add to my previous email, you can see here the traffic and errors for the GAM project API:
image.png

It's basically backing off constantly after the initial 100 requests, which is actually about 50 users when switching licenses.

Hope that helps a bit more to see what is happening there.

Kind regards,

Ivan Boskovic
Technical Support Engineer at Damson Cloud Ltd




Ivan Boskovic

unread,
Mar 17, 2023, 4:16:06 AM3/17/23
to google-ap...@googlegroups.com
More detailed metrics with legend:

image.png


The problem with this license API is mostly because the quota is at start at maximum and cannot be increase past this:

image.png


I hope this makes more sense now why I am looking at batching requests through a single API call.

I am fairly certain ther is a way of doing it (not necessarily at the moment with GAM) simply because, when Google pushes a change of SKU from their end for the entire domain, regardless of how many users there are on the account, they all get switched to the new SKU. My logic may be wrong here as I don't know how exactly that works, but I assume it is working on the same principles for API's (although I am aware that they could have another way of doing it, being their system and all).

Kind regards,

Ivan Boskovic
Technical Support Engineer at Damson Cloud Ltd



Jay Lee

unread,
Mar 17, 2023, 7:39:00 AM3/17/23
to google-ap...@googlegroups.com
No. Even if you use HTTP batching Google quota sees it as the same number of requests. You can see that with the "gam info user" command and which batches together dozens of API calls to get each possible license so that GAM can report the user assigned license. When you run that command you should see a significant spike in API traffic.

You can request higher quota from Google or just work within the defaults.

Jay

Ivan Boskovic

unread,
Mar 21, 2023, 5:12:37 AM3/21/23
to GAM for Google Workspace
Hi Jay,

Yeah, that's what I thought, but wanted to geta confirmation.

Thanks again Ross and Jay! Much appreciated.



Reply all
Reply to author
Forward
0 new messages