Skip to content

Latest commit

 

History

History
496 lines (330 loc) · 29.2 KB

AccountingPeriodsApi.md

File metadata and controls

496 lines (330 loc) · 29.2 KB

Zuora::AccountingPeriodsApi

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

Method HTTP request Description
delete_accounting_period DELETE /v1/accounting-periods/{ap-id} Delete accounting period
get_accounting_period GET /v1/accounting-periods/{ap-id} Get accounting period
get_all_accounting_periods GET /v1/accounting-periods Get all accounting periods
post_accounting_period POST /v1/accounting-periods Create accounting period
put_close_accounting_period PUT /v1/accounting-periods/{ap-id}/close Close accounting period
put_pending_close_accounting_period PUT /v1/accounting-periods/{ap-id}/pending-close Set accounting period to pending close
put_reopen_accounting_period PUT /v1/accounting-periods/{ap-id}/reopen Re-open accounting period
put_run_trial_balance PUT /v1/accounting-periods/{ap-id}/run-trial-balance Run trial balance
put_update_accounting_period PUT /v1/accounting-periods/{ap-id} Update accounting period

delete_accounting_period

CommonResponseType delete_accounting_period(ap_id, opts)

Delete accounting period

Deletes an accounting period. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Delete Accounting Period user permission. See Finance Roles. Limitations ----------- The accounting period to be deleted: * Must be the most recent accounting period * Must be an open accounting period * Must have no revenue distributed into it * Must not have any active journal entries * Must not be the open-ended accounting period * Must not be in the process of running a trial balance

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period you want to delete.

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
  #Delete accounting period
  result = api_instance.delete_accounting_period(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->delete_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period you want to delete.
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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

get_accounting_period

GETAccountingPeriodType get_accounting_period(ap_id, opts)

Get accounting period

Retrieves an accounting period. Prerequisites ------------- You must have Zuora Finance enabled on your tenant.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period you want to get.

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
  #Get accounting period
  result = api_instance.get_accounting_period(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->get_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period you want to get.
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

GETAccountingPeriodType

Authorization

No authorization required

HTTP request headers

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

get_all_accounting_periods

GETAccountingPeriodsType get_all_accounting_periods(opts)

Get all accounting periods

Retrieves all accounting periods on your tenant.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

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: 300 # Integer | Number of rows returned per page. 
}

begin
  #Get all accounting periods
  result = api_instance.get_all_accounting_periods(opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->get_all_accounting_periods: #{e}"
end

Parameters

Name Type Description Notes
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 300]

Return type

GETAccountingPeriodsType

Authorization

No authorization required

HTTP request headers

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

post_accounting_period

POSTAccountingPeriodResponseType post_accounting_period(request, opts)

Create accounting period

Creates an accounting period. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Create Accounting Period user permission. Limitations ----------- * When creating the first accounting period on your tenant, the start date must be equal to or earlier than the date of the earliest transaction on the tenant. * Start and end dates of accounting periods must be contiguous. For example, if one accounting period ends on January 31, the next period must start on February 1. * If you have the Revenue Recognition Package and have enabled the "Monthly recognition over time" revenue recognition model, the accounting period start date and end date must be on the first day and last day of the month, respectively. Note that the start and end dates do not necessarily have to be in the same month.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

request = Zuora::POSTAccountingPeriodType.new # POSTAccountingPeriodType | 

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
  #Create accounting period
  result = api_instance.post_accounting_period(request, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->post_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
request POSTAccountingPeriodType
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

POSTAccountingPeriodResponseType

Authorization

No authorization required

HTTP request headers

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

put_close_accounting_period

CommonResponseType put_close_accounting_period(ap_id, opts)

Close accounting period

Close an accounting period by accounting period ID. Prerequisites ------------- You must have Zuora Finance enabled on your tenant. You must have the Manage Close Process and Run Trial Balance user permissions. Limitations ----------- * The accounting period cannot already be closed. * The accounting period cannot be in the process of running a trial balance. * All earlier accounting periods must be closed. * There must be no required action items for the accounting period. See Reconcile Transactions Before Closing an Accounting Period for more information. Notes ----- When you close an accounting period in Zuora, a trial balance is automatically run for that period. A successful response means only that the accounting period is now closed, but does not mean that the trial balance has successfully completed.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period you want to close.

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
  #Close accounting period
  result = api_instance.put_close_accounting_period(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->put_close_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period you want to close.
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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

put_pending_close_accounting_period

CommonResponseType put_pending_close_accounting_period(ap_id, opts)

Set accounting period to pending close

Sets an accounting period to pending close. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Manage Close Process and Run Trial Balance user permissions. Limitations ----------- * The accounting period cannot be closed or pending close. * The accounting period cannot be in the process of running a trial balance. * All earlier accounting periods must be closed. Notes ----- When you set an accounting period to pending close in Zuora, a trial balance is automatically run for that period. A response of { \"success\": true } means only that the accounting period status is now pending close, but does not mean that the trial balance has successfully completed. You can use the Get Accounting Period REST API call to view details about the outcome of the trial balance.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period you want to set to pending close.

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
  #Set accounting period to pending close
  result = api_instance.put_pending_close_accounting_period(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->put_pending_close_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period you want to set to pending close.
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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

put_reopen_accounting_period

CommonResponseType put_reopen_accounting_period(ap_id, opts)

Re-open accounting period

Re-opens an accounting period. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Manage Close Process and Run Trial Balance user permissions. Limitations ----------- * The accounting period must be closed or pending close. * You can only re-open an accounting period that is immediately previous to an open period.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period that you want to re-open.

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
  #Re-open accounting period
  result = api_instance.put_reopen_accounting_period(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->put_reopen_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period that you want to re-open.
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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

put_run_trial_balance

CommonResponseType put_run_trial_balance(ap_id, opts)

Run trial balance

Runs the trial balance for an accounting period. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Manage Close Process and Run Trial Balance user permissions. See Finance Roles. Limitations ----------- * The accounting period must be open. * The accounting period cannot already be in the process of running a trial balance. Notes ----- The trial balance is run asynchronously. A response of { \"success\": true } means only that the trial balance has started processing, but does not mean that the trial balance has successfully completed. You can use the Get Accounting Period REST API call to view details about the outcome of the trial balance.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period for which you want to run a trial balance.

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
  #Run trial balance
  result = api_instance.put_run_trial_balance(ap_id, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->put_run_trial_balance: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period for which you want to run a trial balance.
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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

put_update_accounting_period

CommonResponseType put_update_accounting_period(ap_id, request, opts)

Update accounting period

Updates an accounting period. Prerequisites ------------- * You must have Zuora Finance enabled on your tenant. * You must have the Create Accounting Period user permission. See Finance Roles. Limitations ----------- * You can update the start date of only the earliest accounting period on your tenant. You cannot update the start date of later periods. * If you update the earliest accounting period, the start date must be equal to or earlier than the date of the earliest transaction on the tenant. * Start and end dates of accounting periods must be contiguous. For example, if one accounting period ends on January 31, the next period must start on February 1. * If you have the Revenue Recognition Package and have enabled the "Monthly recognition over time" revenue recognition model, the accounting period start date and end date must be on the first day and last day of the month, respectively. Note that the start and end dates do not necessarily have to be in the same month. * You cannot update the start date or end date of an accounting period if: * Any revenue has been distributed into the period. * The period has any active journal entries.

Example

# load the gem
require 'zuora'

api_instance = Zuora::AccountingPeriodsApi.new

ap_id = "ap_id_example" # String | ID of the accounting period you want to update.

request = Zuora::PUTAccountingPeriodType.new # PUTAccountingPeriodType | 

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
  #Update accounting period
  result = api_instance.put_update_accounting_period(ap_id, request, opts)
  p result
rescue Zuora::ApiError => e
  puts "Exception when calling AccountingPeriodsApi->put_update_accounting_period: #{e}"
end

Parameters

Name Type Description Notes
ap_id String ID of the accounting period you want to update.
request PUTAccountingPeriodType
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

CommonResponseType

Authorization

No authorization required

HTTP request headers

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