- 👟 Ready To Run!
- 🗄️ Administration
- 💰 Credit Management
Requirements
- 🔒 Administrator Privileges
Service credits are the currency used across ArcGIS and are consumed for specific transactions and types of storage such as storing features, performing analytics, and using premium content. Any ArcGIS software that interacts with ArcGIS Online can use credits. Managing credit expenditures is an important component of administering our organization.
To get started managing our credits, let's connect to our organization:
from arcgis.gis import GIS
gis = GIS("home")
There is a CreditManager instance exposed on our gis
via gis.admin.credits
. We can use this to view, allocate credits to our users, set a default limit etc. Run the below cell to view the total amount of credits in our organization:
gis.admin.credits.credits
80404.89
Managing credits through credit budgeting
The credit budgeting feature of ArcGIS Online allows administrators to view, limit and allocate credits to its users. Learn more about credit budgeting here.
We can use the enable()
method to turn on credit budgeting.
gis.admin.credits.enable()
True
We can use the is_enabled
property to verify if credit budgeting is turned on.
gis.admin.credits.is_enabled
True
Once we turn on credit budgeting, we can set a default limit for the number of credits for each user. In addition to this, we can set custom limits to users as well. Default limit applies when we create a new user and do not set a custom limit.
gis.admin.credits.default_limit
8000
Note: If credit budgetting is not enabled/not configured for the organization, the above value will show up as
-1
, andsome_user.assignedCredits
will also show up as-1
. This means that there is no limit, any user can use up to the number of credits in the org.
Allocating credits to a user
We can use the allocate()
and deallocate()
methods to allocate custom number of credits or remove credits from any user in an organization. Let's apply this logic to ourselves.
me = gis.users.me
me
Run the below cell to allocate 1/10th of our organization's credits to us:
credits_alloc = gis.admin.credits.credits / 10
gis.admin.credits.allocate(username=me.username,
credits=credits_alloc)
True
Checking credits assigned and available to a user
When we turn on credit budgeting, the User
object gets additional properties to indicate the assignedCredits
and remaining avialableCredits
. Run the below cells to view our assigned credits and available credits:
me.assignedCredits
8039.734
me.availableCredits
8039.734
As users in our organization continue to use credits, the availableCredits
property can be used to check how much is available for that account. If a user does not have a limit set, then the total available credits in the org become their available credits. The account shown below as not custom limit, hence, it inherits the org's total limit. Run the below cell to check the amount of credits for an arbitrary user:
some_user = gis.users.search("some_user")[0]
some_user.assignedCredits
8039.734
some_user.availableCredits
8039.734
Disable credit budgeting
We can disable credit budgetting by calling the disable()
method.
gis.admin.credits.disable()
True
Additional Resources
To learn more about credit management in ArcGIS Online, see these resources: