Update enterprise properties via API




Introduction to working with enterprise properties in the API

Enterprise properties enable you to store tenant metadata and you can also use them to configure billing dashboards and integrations, such as the VMware NSX integration, Azure VPNs, and onboard from public cloud.

To retrieve or update enterprise properties, you will require the following privilege:

  • Allow user to switch enterprise:  ROLE_ENTERPRISE_ADMINISTER_ALL

There are three types of enterprise properties:

  • READ_WRITE
  • READ_ONLY
  • HIDDEN

To update READ_ONLY or HIDDEN properties you will require the following privilege:

  • Manage enterprise properties: ENTERPRISE_MANAGE_PROPERTIES


When you update enterprise properties using the API, you will overwrite all existing properties  

Default properties:

  • If you created the enterprise using the API, by default there are no properties.
  • If you created the enterprise using the user interface, some default properties and values may have been defined and/or modified. See Predefine enterprise properties for the UI

For details of how to manage enterprise properties in the UI, see:




Retrieve enterprises by property key or value

When you get enterprises, you can filter enterprises by their properties using the "prop" query parameter.  The platform combines the filters with an OR operator.

For example:

  • To get enterprises that have property pairs Key1=Value1 or Key2=Value2 get the enterprises with the query parameters as shown here:

    admin/enterprises?prop.Key1=Value1&prop.Key2=Value2


  • Enterprises with properties with key 'Key1' and any value: 

    admin/enterprises?prop.Key1
  • Enterprises with properties with value 'Value1' and any key: 

    admin/enterprises?prop=Value1

The following query gives an example of how  to get all the enterprises that have the "dataset_id" property:

curl -X GET 'https://abiquo.example.com/api/admin/enterprises?prop.dataset_id' \
-H 'Accept: application/vnd.abiquo.enterprises+json;version=5.2' \
-H 'Authorization: Token a2e19816735381c1d077771cbd002aaaaa33355111f8881d5a27124006189a0f333eed68bebcb336583737aba6666cc4ff8f8c9174d9529d59237afb537c7db'

In our system, this query returns a collection of two enterprises. 

 Click here to show/hide the sample response
{
    "totalSize": 2,
    "links": [
        {
            "rel": "first",
            "href": "https://abiquo.example.com:443/api/admin/enterprises?prop.dataset_id=null&limit=25&by=name&asc=true"
        },
        {
            "rel": "last",
            "href": "https://abiquo.example.com:443/api/admin/enterprises?prop.dataset_id=null&startwith=0&limit=25&by=name&asc=true"
        }
    ],
    "collection": [
        {
            "id": 8,
            "name": "Google Cloud enterprise api-project",
            "isReservationRestricted": false,
            "idPricingTemplate": 1,
            "workflow": false,
            "twoFactorAuthenticationMandatory": false,
            "reseller": false,
            "keyNode": false,
            "diskSoftLimitInMb": 0,
            "diskHardLimitInMb": 0,
            "storageSoftInMb": 0,
            "storageHardInMb": 0,
            "vmsSoft": 0,
            "vmsHard": 0,
            "drProtectedVmsSoft": 0,
            "drProtectedVmsHard": 0,
            "vlansSoft": 0,
            "vlansHard": 0,
            "publicIpsSoft": 0,
            "publicIpsHard": 0,
            "repositorySoftInMb": 0,
            "repositoryHardInMb": 0,
            "links": [
                {
                    "title": "Google Cloud enterprise api-project",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8"
                },
                {
                    "title": "users",
                    "rel": "users",
                    "type": "application/vnd.abiquo.users+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/users"
                },
                {
                    "title": "properties",
                    "rel": "properties",
                    "type": "application/vnd.abiquo.enterpriseproperties+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/properties"
                },
                {
                    "title": "Global scope",
                    "rel": "scope",
                    "type": "application/vnd.abiquo.scope+json",
                    "href": "https://abiquo.example.com:443/api/admin/scopes/1"
                },
                {
                    "title": "template definitions lists",
                    "rel": "appslib/templateDefinitionLists",
                    "type": "application/vnd.abiquo.templatedefinitionlists+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/appslib/templateDefinitionLists"
                },
                {
                    "title": "template defintion paths",
                    "rel": "appslib/templateDefinitions",
                    "type": "application/vnd.abiquo.templatedefinitions+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/appslib/templateDefinitions"
                },
                {
                    "title": "repositories",
                    "rel": "datacenterrepositories",
                    "type": "application/vnd.abiquo.datacenterrepositories+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/datacenterrepositories"
                },
                {
                    "title": "virtual machines",
                    "rel": "virtualmachines",
                    "type": "application/vnd.abiquo.virtualmachines+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/virtualmachines"
                },
                {
                    "title": "virtual appliances",
                    "rel": "virtualappliances",
                    "type": "application/vnd.abiquo.virtualappliances+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/virtualappliances"
                },
                {
                    "title": "ips",
                    "rel": "ips",
                    "type": "application/vnd.abiquo.privateips+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/ips"
                },
                {
                    "title": "virtual datacenters",
                    "rel": "cloud/virtualdatacenters",
                    "type": "application/vnd.abiquo.virtualdatacenters+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/virtualdatacenters"
                },
                {
                    "title": "dfsfsa",
                    "rel": "pricingtemplate",
                    "type": "application/vnd.abiquo.pricingtemplate+json",
                    "href": "https://abiquo.example.com:443/api/config/pricingtemplates/1"
                },
                {
                    "title": "reserved machines",
                    "rel": "reservedmachines",
                    "type": "application/vnd.abiquo.machines+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/reservedmachines"
                },
                {
                    "title": "limits",
                    "rel": "limits",
                    "type": "application/vnd.abiquo.limits+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/limits"
                },
                {
                    "title": "providerlimits",
                    "rel": "providerlimits",
                    "type": "application/vnd.abiquo.providerlimits+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/providerlimits"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/volumes"
                },
                {
                    "title": "external networks",
                    "rel": "externalnetworks",
                    "type": "application/vnd.abiquo.vlans+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/externalnetworks"
                },
                {
                    "title": "pending tasks",
                    "rel": "pendingtasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/action/pendingtasks"
                },
                {
                    "title": "credentials",
                    "rel": "credentials",
                    "type": "application/vnd.abiquo.publiccloudcredentialslist+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/credentials"
                },
                {
                    "title": "pricingcredentials",
                    "rel": "pricingcredentials",
                    "type": "application/vnd.abiquo.pricingcredentialslist+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/pricingcredentials"
                },
                {
                    "title": "virtual appliances specs",
                    "rel": "vappspecs",
                    "type": "application/vnd.abiquo.virtualappliancespecs+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/vappspecs"
                },
                {
                    "title": "bills",
                    "rel": "bills",
                    "type": "application/vnd.abiquo.bills+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/8/bills"
                },
                {
                    "title": "billregisters",
                    "rel": "billregisters",
                    "type": "application/vnd.abiquo.bills+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/8/billregisters"
                },
                {
                    "title": "estimation",
                    "rel": "estimation",
                    "type": "text/plain",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/8/billregisters/action/estimate"
                },
                {
                    "title": "Bill providers",
                    "rel": "billproviders",
                    "type": "application/vnd.abiquo.billproviders+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/8/bills/action/providers"
                },
                {
                    "title": "Budgets",
                    "rel": "budgets",
                    "type": "application/vnd.abiquo.budgets+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/8/budgets"
                },
                {
                    "title": "Global Networks",
                    "rel": "globalnetworks",
                    "type": "application/vnd.abiquo.globalnetworks+json",
                    "href": "https://abiquo.example.com:443/api/cloud/globalnetworks"
                }
            ],
            "ramSoft": 0,
            "ramHard": 0,
            "cpuSoft": 0,
            "cpuHard": 0
        },
        {
            "id": 12,
            "name": "Google Cloud enterprise billingproject",
            "isReservationRestricted": false,
            "idPricingTemplate": 2,
            "workflow": false,
            "twoFactorAuthenticationMandatory": false,
            "reseller": false,
            "keyNode": false,
            "diskSoftLimitInMb": 0,
            "diskHardLimitInMb": 0,
            "storageSoftInMb": 0,
            "storageHardInMb": 0,
            "vmsSoft": 0,
            "vmsHard": 0,
            "drProtectedVmsSoft": 0,
            "drProtectedVmsHard": 0,
            "vlansSoft": 0,
            "vlansHard": 0,
            "publicIpsSoft": 0,
            "publicIpsHard": 0,
            "repositorySoftInMb": 0,
            "repositoryHardInMb": 0,
            "links": [
                {
                    "title": "Google Cloud enterprise billingproject",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.enterprise+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12"
                },
                {
                    "title": "users",
                    "rel": "users",
                    "type": "application/vnd.abiquo.users+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/users"
                },
                {
                    "title": "properties",
                    "rel": "properties",
                    "type": "application/vnd.abiquo.enterpriseproperties+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/properties"
                },
                {
                    "title": "Global scope",
                    "rel": "scope",
                    "type": "application/vnd.abiquo.scope+json",
                    "href": "https://abiquo.example.com:443/api/admin/scopes/1"
                },
                {
                    "title": "template definitions lists",
                    "rel": "appslib/templateDefinitionLists",
                    "type": "application/vnd.abiquo.templatedefinitionlists+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/appslib/templateDefinitionLists"
                },
                {
                    "title": "template defintion paths",
                    "rel": "appslib/templateDefinitions",
                    "type": "application/vnd.abiquo.templatedefinitions+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/appslib/templateDefinitions"
                },
                {
                    "title": "repositories",
                    "rel": "datacenterrepositories",
                    "type": "application/vnd.abiquo.datacenterrepositories+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/datacenterrepositories"
                },
                {
                    "title": "virtual machines",
                    "rel": "virtualmachines",
                    "type": "application/vnd.abiquo.virtualmachines+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/virtualmachines"
                },
                {
                    "title": "virtual appliances",
                    "rel": "virtualappliances",
                    "type": "application/vnd.abiquo.virtualappliances+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/virtualappliances"
                },
                {
                    "title": "ips",
                    "rel": "ips",
                    "type": "application/vnd.abiquo.privateips+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/ips"
                },
                {
                    "title": "virtual datacenters",
                    "rel": "cloud/virtualdatacenters",
                    "type": "application/vnd.abiquo.virtualdatacenters+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/virtualdatacenters"
                },
                {
                    "title": "blah",
                    "rel": "pricingtemplate",
                    "type": "application/vnd.abiquo.pricingtemplate+json",
                    "href": "https://abiquo.example.com:443/api/config/pricingtemplates/2"
                },
                {
                    "title": "reserved machines",
                    "rel": "reservedmachines",
                    "type": "application/vnd.abiquo.machines+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/reservedmachines"
                },
                {
                    "title": "limits",
                    "rel": "limits",
                    "type": "application/vnd.abiquo.limits+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/limits"
                },
                {
                    "title": "providerlimits",
                    "rel": "providerlimits",
                    "type": "application/vnd.abiquo.providerlimits+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/providerlimits"
                },
                {
                    "title": "volumes",
                    "rel": "volumes",
                    "type": "application/vnd.abiquo.volumes+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/volumes"
                },
                {
                    "title": "external networks",
                    "rel": "externalnetworks",
                    "type": "application/vnd.abiquo.vlans+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/externalnetworks"
                },
                {
                    "title": "pending tasks",
                    "rel": "pendingtasks",
                    "type": "application/vnd.abiquo.tasks+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/action/pendingtasks"
                },
                {
                    "title": "credentials",
                    "rel": "credentials",
                    "type": "application/vnd.abiquo.publiccloudcredentialslist+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/credentials"
                },
                {
                    "title": "pricingcredentials",
                    "rel": "pricingcredentials",
                    "type": "application/vnd.abiquo.pricingcredentialslist+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/pricingcredentials"
                },
                {
                    "title": "virtual appliances specs",
                    "rel": "vappspecs",
                    "type": "application/vnd.abiquo.virtualappliancespecs+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/vappspecs"
                },
                {
                    "title": "bills",
                    "rel": "bills",
                    "type": "application/vnd.abiquo.bills+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/12/bills"
                },
                {
                    "title": "billregisters",
                    "rel": "billregisters",
                    "type": "application/vnd.abiquo.bills+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/12/billregisters"
                },
                {
                    "title": "estimation",
                    "rel": "estimation",
                    "type": "text/plain",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/12/billregisters/action/estimate"
                },
                {
                    "title": "Bill providers",
                    "rel": "billproviders",
                    "type": "application/vnd.abiquo.billproviders+json",
                    "href": "https://abiquo.example.com:443/api/statistics/enterpriseresources/12/bills/action/providers"
                },
                {
                    "title": "Budgets",
                    "rel": "budgets",
                    "type": "application/vnd.abiquo.budgets+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/budgets"
                },
                {
                    "title": "Global Networks",
                    "rel": "globalnetworks",
                    "type": "application/vnd.abiquo.globalnetworks+json",
                    "href": "https://abiquo.example.com:443/api/cloud/globalnetworks"
                }
            ],
            "ramSoft": 0,
            "ramHard": 0,
            "cpuSoft": 0,
            "cpuHard": 0
        }
    ]
}


To get all enterprises with a property that has a key of "dataset_id"  and a value of "billingDatasetId22", you could use the following query.

curl -X GET 'https://abiquo.example.com/api/admin/enterprises?prop.dataset_id=billingDatasetId22' \
    -H 'Accept: application/vnd.abiquo.enterprises+json;version=5.2' \
    -H 'Authorization: Token a2e19816735381c1d077771cbd002aaaaa33355111f8881d5a27124006189a0f333eed68bebcb336583737aba6666cc4ff8f8c9174d9529d59237afb537c7db'




Get the properties of an enterprise

To retrieve the existing enterprise properties from an enterprise, get the properties link from the enterprise's data object. 

 Click here to show/hide the properties link

For one of the enterprises in the above example, the link is as follows.

                {
                    "title": "properties",
                    "rel": "properties",
                    "type": "application/vnd.abiquo.enterpriseproperties+json",
                    "href": "https://abiquo.example.com:443/api/admin/enterprises/12/properties"
                },

Make a GET request to the properties link similar to the one shown here.

curl -X GET https://abiquo.example.com:443/api/admin/enterprises/12/properties
	 -H 'Accept:application/vnd.abiquo.enterpriseproperties+json;version=5.2' \ 
     -u user:password --verbose

The response is an enterpriseproperties object as follows.

{
    "links": [
        {
            "title": "enterprise properties",
            "rel": "edit",
            "type": "application/vnd.abiquo.enterpriseproperties+json",
            "href": "https://abiquo.example.com:443/api/admin/enterprises/12/properties"
        },
        {
            "title": "Google Cloud enterprise billingproject",
            "rel": "enterprise",
            "type": "application/vnd.abiquo.enterprise+json",
            "href": "https://abiquo.example.com:443/api/admin/enterprises/12"
        }
    ],
    "properties": [
        {
            "accessType": "READ_WRITE",
            "key": "dataset_id",
            "value": "billingDatasetId22"
        }
    ]
}




Update enterprise properties

To update enterprise properties using the API, enter the properties in key and value format. 

When you update enterprise properties you will overwrite the existing properties.


When you make the put request, use an enterpriseproperties object, similar to this example. See https://wiki.abiquo.com/api/latest/enterpriseproperties.html

-d '{
    "properties": [
        {
            "key": "account_id",
            "value": "ABC123",
            "accessType": "READ_WRITE"
        },
        {
            "key": "billing_code",
            "value": "premiumAAA",
            "accessType": "HIDDEN"
        },
        {
            "key": "cost_center",
            "value": "123ABC",
            "accessType": "READ_ONLY"
        },
        {
            "key": "dataset_id",
            "value": "billingDatasetId22",
            "accessType": "READ_WRITE"
        }
    ]
}

The full PUT request to update the properties with this data entity would be as follows.

Remember that you will require the privileges listed in the Introduction to enterprise properties in the API.

curl -X PUT 'https://abiquo.example.com/api/admin/enterprises/12/properties' \
    -H 'Accept: application/vnd.abiquo.enterpriseproperties+json;version=5.2' \
	-H 'Content-Type: application/vnd.abiquo.enterpriseproperties+json;version=5.2' \
	-d '{"links":[],"properties":[{"key":"account_id","value":"ABC123","accessType":"READ_WRITE"},{"key":"billing_code","value":"premiumAAA","accessType":"HIDDEN"},{"key":"cost_center","value":"123ABC","accessType":"READ_ONLY"},{"key":"dataset_id","value":"billingDatasetId22","accessType":"READ_WRITE"}]}'

And an example response would be as follows:

 Click here to show/hide the sample response

Sample updated enterprise properties

{
    "links": [
        {
            "title": "enterprise properties",
            "rel": "edit",
            "type": "application/vnd.abiquo.enterpriseproperties+json",
            "href": "https://abiquo.example.com:443/api/admin/enterprises/12/properties"
        },
        {
            "title": "Google Cloud enterprise billingproject",
            "rel": "enterprise",
            "type": "application/vnd.abiquo.enterprise+json",
            "href": "https://abiquo.example.com:443/api/admin/enterprises/12"
        }
    ],
    "properties": [
        {
            "accessType": "READ_WRITE",
            "key": "account_id",
            "value": "ABC123"
        },
        {
            "accessType": "HIDDEN",
            "key": "billing_code",
            "value": "premiumAAA"
        },
        {
            "accessType": "READ_ONLY",
            "key": "cost_center",
            "value": "123ABC"
        },
        {
            "accessType": "READ_WRITE",
            "key": "dataset_id",
            "value": "billingDatasetId22"
        }
    ]
}




Related pages

Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved