sbGetUsageCreationStatus
Use this method to get the status and results of the usage creation request made using the sbCreateUsage method. Use the request ID returned by the sbCreateUsage method when you send a request using this method.
When the RESTlet receives a request using this method, it searches for the SuiteBilling operation record associated with the request ID. If an operation record is found, the method returns the usage creation status in the response object.
Request Properties
Property |
Data Type |
Required? |
Description |
---|---|---|---|
|
string |
Yes |
Method name of the process to run. In this case, value must be |
|
number |
Yes |
Internal ID of the SuiteBilling operation record. This value is returned by the |
Sample Request
{
"method": "sbGetUsageCreationStatus",
"requestId": "1101"
}
Response Properties
Property |
Data Type |
Description |
---|---|---|
|
number |
Internal ID of the SuiteBilling operation record. |
|
string |
Status of the usage creation, which can be any of these values:
|
|
object |
Result object that contains the information of successful records, failed records, and unhandled errors. |
|
array |
Array list of usage objects that are successfully created. Each object contains the index, data, and result.
|
|
array |
Array list of usage objects that failed. Each object contains index, data, and result.
|
|
array |
Array list of error information that occurred at different stages of the map/reduce script. These errors occurred outside the scope of usage creation (that is, beyond SuiteBilling Operation Detail record creation).
|
Sample Response
This example shows the response when the operation record for the request ID is obtained. In this case, the usage creation is completed, one record is created successfully, one fails, and there are no unhandled errors.
{
"requestId": "1101",
"status": "Completed",
"result": {
"successes": [
{
"index": 0,
"data": {
"subscription": "1",
"line": "3",
"quantity": "5",
"date": "1/3/2018",
"memo": "this is a note"
},
"result": {
"usageId": 101
}
}
],
"failures": [
{
"index": 1,
"data": {
"subscription": "1",
"line": "5",
"quantity": "15",
"date": "1/3/2018"
},
"result": {
"name": "INVALID_KEY_OR_REF",
"message": "Invalid usagesubscriptionline reference key Ems SP 001 - 1/1/2018: 5."
}
}
],
"errors": []
}
}
In the next example, the status of the usage creation is completed and there is one unhandled error.
{
"requestId": "1102",
"status": "Completed",
"result": {
"successes": [],
"failures": [],
"errors": [
{
"stage": "reduce",
"key":"906",
"name":"UNEXPECTED_ERROR",
"message":"An unexpected error occurred."
}
]
}
}