Cost tracking

Cost tracking

/api/service-price-list-items/

Supported actions and methods:

/api/service-price-list-items/

Methods: GET, POST

Supported fields for creation:

  • units – string
  • value – float
  • serviceGenericRelatedField
  • default_price_list_itemlink to /api/default-price-list-items/<uuid>/

To get a list of price list items, run GET against /api/price-list-items/ as an authenticated user. Run POST request against /api/price-list-items/ to create new price list item. Customer owner and staff can create price items.

Example of request:

POST /api/price-list-items/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "units": "per month",
    "value": 100,
    "service": "http://example.com/api/oracle/d4060812ca5d4de390e0d7a5062d99f6/",
    "default_price_list_item": "http://example.com/api/default-price-list-items/349d11e28f634f48866089e41c6f71f1/"
}

Run PATCH request against /api/price-list-items/<uuid>/ to update price list item. Only item_type, key value and units can be updated. Only customer owner and staff can update price items. Run DELETE request against /api/price-list-items/<uuid>/ to delete price list item. Only customer owner and staff can delete price items.

/api/service-price-list-items/<uuid>/

Methods: GET, PUT, PATCH, DELETE

Supported fields for update:

  • units – string
  • value – float

Run POST request against /api/price-list-items/ to create new price list item. Customer owner and staff can create price items.

Example of request:

POST /api/price-list-items/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "units": "per month",
    "value": 100,
    "service": "http://example.com/api/oracle/d4060812ca5d4de390e0d7a5062d99f6/",
    "default_price_list_item": "http://example.com/api/default-price-list-items/349d11e28f634f48866089e41c6f71f1/"
}

Run PATCH request against /api/price-list-items/<uuid>/ to update price list item. Only item_type, key value and units can be updated. Only customer owner and staff can update price items. Run DELETE request against /api/price-list-items/<uuid>/ to delete price list item. Only customer owner and staff can delete price items.

/api/price-estimates/

Scope filters:

  • ?scope = URL
  • ?scope_type = string (can be list)

Supported actions and methods:

/api/price-estimates/

Methods: GET, POST

Supported fields for creation:

  • scopelink to any: /api/service-settings/<uuid>/, /api/projects/<uuid>/, /api/customers/<uuid>/
  • total – float (Predicted price for scope for current month.)
  • consumed – float (Price for resource until now.)
  • monthinteger
  • yearinteger
  • threshold – float

To get a list of price estimates, run GET against /api/price-estimates/ as authenticated user. You can filter price estimates by scope type, scope URL, customer UUID.

scope_type is generic type of object for which price estimate is calculated. Currently there are following types: customer, project, service, serviceprojectlink, resource.

date parameter accepts list of dates. start and end parameters together specify date range. Each valid date should in format YYYY.MM

You can specify GET parameter ?depth to show price estimate children. For example with ?depth=2 customer price estimate will shows its children - project and service and grandchildren - serviceprojectlink.

/api/price-estimates/limit/

Methods: POST

Run POST request against /api/price-estimates/limit/ to set price estimate limit. When limit is set, provisioning is disabled if total estimated monthly cost of project and resource exceeds project cost limit. If limit is -1, project cost limit do not apply. Example request:

POST /api/price-estimates/limit/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "scope": "http://example.com/api/projects/ab2e3d458e8a4ecb9dded36f3e46878d/",
    "limit": 100.0
}

/api/price-estimates/threshold/

Methods: POST

Run POST request against /api/price-estimates/threshold/ to set alert threshold for price estimate. Example request:

POST /api/price-estimates/threshold/
Accept: application/json
Content-Type: application/json
Authorization: Token c84d653b9ec92c6cbac41c706593e66f567a7fa4
Host: example.com

{
    "scope": "http://example.com/api/projects/ab2e3d458e8a4ecb9dded36f3e46878d/",
    "threshold": 100.0
}

/api/price-estimates/<uuid>/

Methods: GET, POST, PUT, PATCH, DELETE

/api/merged-price-list-items/

Supported actions and methods:

/api/merged-price-list-items/

Methods: GET

To get a list of price list items, run GET against /api/merged-price-list-items/ as authenticated user.

If service is not specified default price list items are displayed. Otherwise service specific price list items are displayed. In this case rendered object contains {“is_manually_input”: true}

In order to specify service pass query parameters: - service_type (Azure, OpenStack etc.) - service_uuid

Example URL: http://example.com/api/merged-price-list-items/?service_type=Azure&service_uuid=cb658b491f3644a092dd223e894319be

/api/merged-price-list-items/<uuid>/

Methods: GET

/api/default-price-list-items/

Supported actions and methods:

/api/default-price-list-items/

Methods: GET

To get a list of default price list items, run GET against /api/default-price-list-items/ as authenticated user.

Price lists can be filtered by:
  • ?key=<string>
  • ?item_type=<string> has to be from list of available item_types (available options: ‘flavor’, ‘storage’, ‘license-os’, ‘license-application’, ‘network’, ‘support’)
  • ?resource_type=<string> resource type, for example: ‘OpenStack.Instance, ‘Oracle.Database’)

/api/default-price-list-items/<uuid>/

Methods: GET