Manage licenses using Graph API

Grant licenses

To an organization:

POST /graph/ProductPackage[@title='DemoPackage']
Content-Type: application/x-www-form-urlencoded

operation=InitializeOrganizationLicenses&licensedItemCount=HOW_MANY_LICENSES&ownerOrganizationId=ORGANIZATION_ID&validFrom=ISO_8601_TIMESTAMP&validUntil=ISO_8601_TIMESTAMP

To an individual user:

POST /graph/ProductPackage[@title='DemoPackage']
Content-Type: application/x-www-form-urlencoded

operation=InitializePersonalLicenses&licensedItemCount=HOW_MANY_LICENSES&initializeForProfileId=PROFILE_ID&validFrom=ISO_8601_TIMESTAMP&validUntil=ISO_8601_TIMESTAMP

Change license validity

For an organization license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=validity&validFrom=ISO_8601_TIMESTAMP&validUntil=ISO_8601_TIMESTAMP&operation=InitializeOrganizationLicenses&ownerOrganizationId=ORGANIZATION_ID

For a personal license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=validity&validFrom=ISO_8601_TIMESTAMP&validUntil=ISO_8601_TIMESTAMP&operation=InitializePersonalLicenses&initializeForProfileId=PROFILE_ID

Change a license’s count or quota

For an organization license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=quota&licensedItemCount=NEW_COUNT&operation=InitializeOrganizationLicenses&ownerOrganizationId=ORGANIZATION_ID

For a personal license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=quota&licensedItemCount=NEW_COUNT&operation=InitializePersonalLicenses&initializeForProfileId=PROFILE_ID

Change a license’s maximum aggregated use time

For an organization license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=aggregateUseTime&maxAggregateUseTime=NEW_TIME_LIMIT_MILLISECONDS&incrementModel=NEW_INCREMENT_MODEL&operation=InitializeOrganizationLicenses&ownerOrganizationId=ORGANIZATION_ID

For a personal license:

POST /graph/License[@id='LICENSE_ID']
Content-Type: application/x-www-form-urlencoded

change=aggregateUseTime&maxAggregateUseTime=NEW_TIME_LIMIT_MILLISECONDS&incrementModel=NEW_INCREMENT_MODEL&operation=InitializePersonalLicenses&initializeForProfileId=PROFILE_ID

The supported incrementModel values are fair OR append. See more information on how the values work in the AggregateUseConstraint constraint.

Note: This API request allows setting the maximum use time after granting the licenses. The convenience is that there’s no need for multiple license models that define different values. The customer-specific time value can be set in a customer-specific way.

License consumption by organization

GET /graph/Organization[@name='Acme Inc']/~OneToMany/Entitlement/~OneToMany/License/~OneToMany/Assignment:LicenseProfileAssignment/~OneToMany/Consumption:LicenseProfileAssignmentConsumption

Who is using an organization’s licenses

GET /graph/Organization/~OneToMany/Entitlement/~OneToMany/License/~Assignment:LicenseProfileAssignment/~ManyToOne/Profile

List an organization’s licenses with names of users

GET /graph/Organization/~OneToMany/Entitlement/~OneToMany/License?/~ManyToOne/LicensedItem&/~Assignment:LicenseProfileAssignment/Profile

Reserve a license seat

If a license uses a named-seat license model, a license seat is reserved for the user by creating a reservation assignment.

A static reservation can be also used with floating licences to reserve a license seat for critical users.

POST /graph/
Content-Type: application/x-www-form-urlencoded

operation=CreateOrUpdateAssignments&createAssignment=true&profileId=PROFILE_ID&reservationType=reserved&licenseId=LICENSE_ID

Remove a seat reservation

If you need to change the named license seat to another user or otherwise remove a seat reservation from a user, you clear the reservation by resetting the reservation type of an assignment.

This operation doesn’t affect the existing session, that is, the seat’s lease period promised in the last license check. The user can use the same reserved seat until they release it or the lease period expires.

POST /graph/
Content-Type: application/x-www-form-urlencoded

operation=CreateOrUpdateAssignments&createAssignment=true&profileId=PROFILE_ID&reservationType=&licenseId=LICENSE_ID

Deny license consumption

License consumption can be denied from specific users by creating a denial assignment.

After denial, the user can consume the license until the end of the session, that is, the period promised in the last license check.

POST /graph/
Content-Type: application/x-www-form-urlencoded

operation=CreateOrUpdateAssignments&createAssignment=true&profileId=PROFILE_ID&reservationType=denied&licenseId=LICENSE_ID

Remove denial

To clear the denial state, that is, to allow a user to consume a floating license, the reservation type of assignment is reset (the same operation as when clearing a seat reservation).

POST /graph/
Content-Type: application/x-www-form-urlencoded

operation=CreateOrUpdateAssignments&createAssignment=true&profileId=PROFILE_ID&reservationType=&licenseId=LICENSE_ID

Release licenses

POST /authz/?AssignmentConsumptionId&release

To find out AssignmentConsumptionId:

  • If you have the client application that called the license check, you probably have the jti field from the token stored. The jti field value is the identifier of the consumption, and you can use it in the /authz/?release call.

    {
    "DemoItem1": true,
    "iss": "df585c1b-f09d-4c04-87f8-b72a515c6f3e",
    "exp": 1452750138,
    "iat": 1452690138,
    "ibe": 101452690135,
    "jti": "5e3831d6-352e-48c8-84a7-54ecc651fa0e",
    "rfr": 1452690738
    }
    
  • If it’s a user or client application you don’t have access to, you can use the following call with the profile id. This reads all consumption lease identifiers that are the result of that specific user consuming the licenses. Using that result set you can iterate over it and call /authz/?release with each leaseId:

    GET /graph/Profile[@id='PROFILE_ID_HERE]/Assignment:LicenseProfileAssignment/~OneToMany/Consumption:LicenseProfileAssignmentConsumption/@leaseId