Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oQueryParams = ObjCreate("Chilkat.JsonObject")
$oQueryParams.UpdateString("from_date","{{from_date}}")
$oQueryParams.UpdateString("to_date","{{to_date}}")
; Adds the "Authorization: Bearer {{accessToken}}" header.
$oHttp.AuthToken = "{{accessToken}}"
$oHttp.SetRequestHeader "Accept","application/json"
Local $oResp = $oHttp.QuickRequestParams("GET","https://domain.com/v2.1/accounts/{{accountId}}/billing_invoices",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)
Curl Command
curl -G -d "from_date=%7B%7Bfrom_date%7D%7D"
-d "to_date=%7B%7Bto_date%7D%7D"
-H "Accept: application/json"
-H "Authorization: Bearer {{accessToken}}"
https://domain.com/v2.1/accounts/{{accountId}}/billing_invoices
Postman Collection Item JSON
{
"name": "Get a List of Billing Invoices",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{accessToken}}"
}
],
"url": {
"raw": "{{baseUrl}}/v2.1/accounts/{{accountId}}/billing_invoices?from_date={{from_date}}&to_date={{to_date}}",
"host": [
"{{baseUrl}}"
],
"path": [
"v2.1",
"accounts",
"{{accountId}}",
"billing_invoices"
],
"query": [
{
"key": "from_date",
"value": "{{from_date}}"
},
{
"key": "to_date",
"value": "{{to_date}}"
}
],
"variable": [
{
"key": "accountId",
"value": "{{accountId}}",
"type": "string"
}
]
},
"description": "Retrieves a list of invoices for the account. If the from date or to date queries are not specified, the response returns invoices for the last 365 days.\n\nPrivileges required: account administrator "
},
"response": [
]
}