Skip to content

Latest commit

 

History

History
339 lines (222 loc) · 18.5 KB

UsageApi.md

File metadata and controls

339 lines (222 loc) · 18.5 KB

Zuora::UsageApi

All URIs are relative to https://rest.zuora.com

Method HTTP request Description
get_usage GET /v1/usage/accounts/{account-key} Get usage
object_delete_usage DELETE /v1/object/usage/{id} CRUD: Delete Usage
object_get_usage GET /v1/object/usage/{id} CRUD: Retrieve Usage
object_post_usage POST /v1/object/usage CRUD: Create Usage
object_put_usage PUT /v1/object/usage/{id} CRUD: Update Usage
post_usage POST /v1/usage Post usage

get_usage

GETUsageWrapper get_usage(account_key, opts)

Get usage

This REST API reference describes how to retrieve usage details for an account. Usage data is returned in reverse chronological order.

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

account_key = "account_key_example" # String | Account number or account ID.

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  page_size: 20 # Integer | Number of rows returned per page. 
}

begin
  #Get usage
  result = api_instance.get_usage(account_key, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->get_usage: #{e}"
end

Parameters

Name Type Description Notes
account_key String Account number or account ID.
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
page_size Integer Number of rows returned per page. [optional] [default to 20]

Return type

GETUsageWrapper

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

object_delete_usage

ProxyDeleteResponse object_delete_usage(id, opts)

CRUD: Delete Usage

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

id = "id_example" # String | Object id

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
}

begin
  #CRUD: Delete Usage
  result = api_instance.object_delete_usage(id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->object_delete_usage: #{e}"
end

Parameters

Name Type Description Notes
id String Object id
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]

Return type

ProxyDeleteResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

object_get_usage

ProxyGetUsage object_get_usage(id, opts)

CRUD: Retrieve Usage

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

id = "id_example" # String | Object id

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  fields: "fields_example" # String | Object fields to return
}

begin
  #CRUD: Retrieve Usage
  result = api_instance.object_get_usage(id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->object_get_usage: #{e}"
end

Parameters

Name Type Description Notes
id String Object id
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
fields String Object fields to return [optional]

Return type

ProxyGetUsage

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

object_post_usage

ProxyCreateOrModifyResponse object_post_usage(create_request, opts)

CRUD: Create Usage

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

create_request = Zuora::ProxyCreateUsage.new # ProxyCreateUsage | 

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
}

begin
  #CRUD: Create Usage
  result = api_instance.object_post_usage(create_request, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->object_post_usage: #{e}"
end

Parameters

Name Type Description Notes
create_request ProxyCreateUsage
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]

Return type

ProxyCreateOrModifyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

object_put_usage

ProxyCreateOrModifyResponse object_put_usage(id, modify_request, opts)

CRUD: Update Usage

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

id = "id_example" # String | Object id

modify_request = Zuora::ProxyModifyUsage.new # ProxyModifyUsage | 

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
}

begin
  #CRUD: Update Usage
  result = api_instance.object_put_usage(id, modify_request, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->object_put_usage: #{e}"
end

Parameters

Name Type Description Notes
id String Object id
modify_request ProxyModifyUsage
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]

Return type

ProxyCreateOrModifyResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8

post_usage

POSTUsageResponseType post_usage(content_type, opts)

Post usage

This REST API reference describes how to post or import usage data for one or more accounts in the CSV format. There are no path or query parameters. The data is uploade using the HTTP multipart/form-data POST method and applied to the user's tenant. ## How this REST API Call Works The content of the upload file must follow the format used by the UI import tool. It must be a comma-separated (CSV) file with a corresponding .csv extension. The length of the file name must not exceed 50 characters. The file size must not exceed 4MB. Click here to download the usage file template. At the completion of the upload, before actually processing the file contents, theAPI returns a response containing the byte count of the received file and a URL for checking the status of the import process. Of the five possible results displayed at that URL Pending, Processing, Completed, Canceled, and Failed) only a Completed status indicates that the import was successful. The operation is atomic; if any record fails, the file is rejected. In that case, the entire import is rolled back and all stored data is returned to its original state. To view the actual import status, enter the resulting status URL from the checkImportStatus response using a tool such as POSTMAN.This additional step provides more information about why the import may have failed. To manage the information after a successful upload, use the web-based UI. ## Upload File Format The upload file uses the following headings: | Heading | Description | Required | |-----------------|--------|----------| | ACCOUNT_ID | Enter the account number, e.g., the default account number, such as A00000001, or your custom account number.,Although this field is labeled as Account_Id, it is not the actual Account ID nor Account Name. | Yes | | UOM | Enter the unit of measure. This must match the UOM for the usage. | Yes | | QTY | Enter the quantity. | Yes | | STARTDATE | Enter the start date of the usage.,This date determines the invoice item service period the associated usage is billed to. Date format is based on locale of the current user. Default date format: MM/DD/YYYY | Yes | | ENDDATE | Enter the end date of the usage.,This is not used in calculations for usage billing and is optional. Date format is based on locale of the current user. Default date format: MM/DD/YYYY | Yes | | SUBSCRIPTION_ID | Enter the subscription number or subscription name. If you created the subscription in the Zuora application, Zuora created a number automatically in a format similar to A-S00000001. If you do not provide a value for this field, the associated usage will be added to all subscriptions for the specified Account that use this Unit Of Measure. If your Accounts can have multiple subscriptions and you do not want double or triple counting of usage, you must specify the Subscription or Charge ID in each usage record. | Yes | | CHARGE_ID | Enter the charge number (not the charge name). You can see the charge ID, e.g., C-00000001, when you add your rate plan to your subscription and view your individual charges. If your Accounts can have multiple subscriptions and you do not want double or triple counting of usage, you must specify the specific Subscription or Charge ID in each usage record. This field is related to the Charge Number on the subscription rate plan. | Yes | | DESCRIPTION | Enter a description for the charge. | No |

Example

# load the gem
require 'zuora'

api_instance = Zuora::UsageApi.new

content_type = "content_type_example" # String | Must be set to \"multipart/form-data\". 

opts = { 
  entity_id: "entity_id_example", # String | The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
  entity_name: "entity_name_example" # String | The [name of the entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity/B_Introduction_to_Entity_and_Entity_Hierarchy#Name_and_Display_Name) that you want to access. Note that you must have permission to access the entity. For more information, see [REST Authentication](https://www.zuora.com/developer/api-reference/#section/Authentication/Entity-Id-and-Entity-Name).
}

begin
  #Post usage
  result = api_instance.post_usage(content_type, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling UsageApi->post_usage: #{e}"
end

Parameters

Name Type Description Notes
content_type String Must be set to "multipart/form-data".
entity_id String The Id of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]
entity_name String The name of the entity that you want to access. Note that you must have permission to access the entity. For more information, see REST Authentication. [optional]

Return type

POSTUsageResponseType

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json; charset=utf-8
  • Accept: application/json; charset=utf-8