Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sUrl
String sContent_type
String sSecret
String sDescription
String sId
Boolean iIs_active
String sDate
String sCode
String sResponse
Integer j
Integer iCount_j
String sStrVal
String sPage
String sPages
String sLimit
String sTotal
Integer i
Integer iCount_i
String sTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "limit" "<integer>" To iSuccess
Get ComUpdateString Of hoQueryParams "page" "<integer>" To iSuccess
Send ComSetRequestHeader To hoHttp "Authorization" "{{apiKey}}"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://api.easybill.de/rest/v1/webhooks" vQueryParams To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "page": "<integer>",
// "pages": "<integer>",
// "limit": "<integer>",
// "total": "<integer>",
// "items": [
// {
// "url": "<string>",
// "content_type": "json",
// "secret": "<string>",
// "events": [
// "document.update",
// "document.deleted"
// ],
// "description": "<string>",
// "id": "<long>",
// "is_active": false,
// "last_response": {
// "date": "<dateTime>",
// "code": "<integer>",
// "response": "<string>"
// }
// },
// {
// "url": "<string>",
// "content_type": "form",
// "secret": "<string>",
// "events": [
// "contact.create",
// "postbox.update"
// ],
// "description": "<string>",
// "id": "<long>",
// "is_active": false,
// "last_response": {
// "date": "<dateTime>",
// "code": "<integer>",
// "response": "<string>"
// }
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComStringOf Of hoJResp "page" To sPage
Get ComStringOf Of hoJResp "pages" To sPages
Get ComStringOf Of hoJResp "limit" To sLimit
Get ComStringOf Of hoJResp "total" To sTotal
Move 0 To i
Get ComSizeOfArray Of hoJResp "items" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "items[i].url" To sUrl
Get ComStringOf Of hoJResp "items[i].content_type" To sContent_type
Get ComStringOf Of hoJResp "items[i].secret" To sSecret
Get ComStringOf Of hoJResp "items[i].description" To sDescription
Get ComStringOf Of hoJResp "items[i].id" To sId
Get ComBoolOf Of hoJResp "items[i].is_active" To iIs_active
Get ComStringOf Of hoJResp "items[i].last_response.date" To sDate
Get ComStringOf Of hoJResp "items[i].last_response.code" To sCode
Get ComStringOf Of hoJResp "items[i].last_response.response" To sResponse
Move 0 To j
Get ComSizeOfArray Of hoJResp "items[i].events" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "items[i].events[j]" To sStrVal
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -G -d "limit=%3Cinteger%3E"
-d "page=%3Cinteger%3E"
-H "Authorization: {{apiKey}}"
-H "Accept: application/json"
https://api.easybill.de/rest/v1/webhooks
Postman Collection Item JSON
{
"name": "Fetch WebHooks list",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/webhooks?limit=<integer>&page=<integer>",
"host": [
"{{baseUrl}}"
],
"path": [
"webhooks"
],
"query": [
{
"key": "limit",
"value": "<integer>",
"description": "Limited the result. Default is 100. Maximum can be 1000."
},
{
"key": "page",
"value": "<integer>",
"description": "Set current Page. Default is 1."
}
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/webhooks?limit=<integer>&page=<integer>",
"host": [
"{{baseUrl}}"
],
"path": [
"webhooks"
],
"query": [
{
"key": "limit",
"value": "<integer>",
"description": "Limited the result. Default is 100. Maximum can be 1000."
},
{
"key": "page",
"value": "<integer>",
"description": "Set current Page. Default is 1."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"page\": \"<integer>\",\n \"pages\": \"<integer>\",\n \"limit\": \"<integer>\",\n \"total\": \"<integer>\",\n \"items\": [\n {\n \"url\": \"<string>\",\n \"content_type\": \"json\",\n \"secret\": \"<string>\",\n \"events\": [\n \"document.update\",\n \"document.deleted\"\n ],\n \"description\": \"<string>\",\n \"id\": \"<long>\",\n \"is_active\": false,\n \"last_response\": {\n \"date\": \"<dateTime>\",\n \"code\": \"<integer>\",\n \"response\": \"<string>\"\n }\n },\n {\n \"url\": \"<string>\",\n \"content_type\": \"form\",\n \"secret\": \"<string>\",\n \"events\": [\n \"contact.create\",\n \"postbox.update\"\n ],\n \"description\": \"<string>\",\n \"id\": \"<long>\",\n \"is_active\": false,\n \"last_response\": {\n \"date\": \"<dateTime>\",\n \"code\": \"<integer>\",\n \"response\": \"<string>\"\n }\n }\n ]\n}"
},
{
"name": "Too Many Requests",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/webhooks?limit=<integer>&page=<integer>",
"host": [
"{{baseUrl}}"
],
"path": [
"webhooks"
],
"query": [
{
"key": "limit",
"value": "<integer>",
"description": "Limited the result. Default is 100. Maximum can be 1000."
},
{
"key": "page",
"value": "<integer>",
"description": "Set current Page. Default is 1."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}