Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; Use this online tool to generate code from sample JSON: Generate Code to Create JSON
; The following JSON is sent in the request body.
; {
; "document_id": "<long>",
; "debitor_name": "<string>",
; "debitor_iban": "<string>",
; "mandate_id": "<string>",
; "mandate_date_of_signature": "<date>",
; "local_instrument": "COR1",
; "sequence_type": "FRST",
; "amount": "<integer>",
; "reference": "<string>",
; "created_at": "<dateTime>",
; "creditor_bic": null,
; "creditor_iban": "<string>",
; "creditor_name": "<string>",
; "debitor_bic": null,
; "debitor_address_line_1": "<string>",
; "debitor_address_line2": "<string>",
; "debitor_country": "<string>",
; "export_at": null,
; "export_error": "<string>",
; "id": "<long>",
; "remittance_information": null,
; "requested_at": "Today's date",
; "updated_at": "<string>",
; "type": "DEBIT"
; }
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(json,"document_id","<long>")
CkJsonObject::ckUpdateString(json,"debitor_name","<string>")
CkJsonObject::ckUpdateString(json,"debitor_iban","<string>")
CkJsonObject::ckUpdateString(json,"mandate_id","<string>")
CkJsonObject::ckUpdateString(json,"mandate_date_of_signature","<date>")
CkJsonObject::ckUpdateString(json,"local_instrument","COR1")
CkJsonObject::ckUpdateString(json,"sequence_type","FRST")
CkJsonObject::ckUpdateString(json,"amount","<integer>")
CkJsonObject::ckUpdateString(json,"reference","<string>")
CkJsonObject::ckUpdateString(json,"created_at","<dateTime>")
CkJsonObject::ckUpdateNull(json,"creditor_bic")
CkJsonObject::ckUpdateString(json,"creditor_iban","<string>")
CkJsonObject::ckUpdateString(json,"creditor_name","<string>")
CkJsonObject::ckUpdateNull(json,"debitor_bic")
CkJsonObject::ckUpdateString(json,"debitor_address_line_1","<string>")
CkJsonObject::ckUpdateString(json,"debitor_address_line2","<string>")
CkJsonObject::ckUpdateString(json,"debitor_country","<string>")
CkJsonObject::ckUpdateNull(json,"export_at")
CkJsonObject::ckUpdateString(json,"export_error","<string>")
CkJsonObject::ckUpdateString(json,"id","<long>")
CkJsonObject::ckUpdateNull(json,"remittance_information")
CkJsonObject::ckUpdateString(json,"requested_at","Today's date")
CkJsonObject::ckUpdateString(json,"updated_at","<string>")
CkJsonObject::ckUpdateString(json,"type","DEBIT")
CkHttp::ckSetRequestHeader(http,"Content-Type","application/json")
CkHttp::ckSetRequestHeader(http,"Authorization","{{apiKey}}")
CkHttp::ckSetRequestHeader(http,"Accept","application/json")
resp.i = CkHttp::ckPostJson3(http,"https://api.easybill.de/rest/v1/sepa-payments","application/json",json)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndIf
sbResponseBody.i = CkStringBuilder::ckCreate()
If sbResponseBody.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpResponse::ckGetBodySb(resp,sbResponseBody)
jResp.i = CkJsonObject::ckCreate()
If jResp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(jResp,sbResponseBody)
CkJsonObject::setCkEmitCompact(jResp, 0)
Debug "Response Body:"
Debug CkJsonObject::ckEmit(jResp)
respStatusCode.i = CkHttpResponse::ckStatusCode(resp)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode >= 400
Debug "Response Header:"
Debug CkHttpResponse::ckHeader(resp)
Debug "Failed."
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndIf
CkHttpResponse::ckDispose(resp)
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "document_id": "<long>",
; "debitor_name": "<string>",
; "debitor_iban": "<string>",
; "mandate_id": "<string>",
; "mandate_date_of_signature": "<date>",
; "local_instrument": "COR1",
; "sequence_type": "FRST",
; "amount": "<integer>",
; "reference": "<string>",
; "created_at": "<dateTime>",
; "creditor_bic": null,
; "creditor_iban": "<string>",
; "creditor_name": "<string>",
; "debitor_bic": null,
; "debitor_address_line_1": "<string>",
; "debitor_address_line2": "<string>",
; "debitor_country": "<string>",
; "export_at": null,
; "export_error": "<string>",
; "id": "<long>",
; "remittance_information": null,
; "requested_at": "Today's date",
; "updated_at": "<string>",
; "type": "DEBIT"
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
document_id.s = CkJsonObject::ckStringOf(jResp,"document_id")
debitor_name.s = CkJsonObject::ckStringOf(jResp,"debitor_name")
debitor_iban.s = CkJsonObject::ckStringOf(jResp,"debitor_iban")
mandate_id.s = CkJsonObject::ckStringOf(jResp,"mandate_id")
mandate_date_of_signature.s = CkJsonObject::ckStringOf(jResp,"mandate_date_of_signature")
local_instrument.s = CkJsonObject::ckStringOf(jResp,"local_instrument")
sequence_type.s = CkJsonObject::ckStringOf(jResp,"sequence_type")
amount.s = CkJsonObject::ckStringOf(jResp,"amount")
reference.s = CkJsonObject::ckStringOf(jResp,"reference")
created_at.s = CkJsonObject::ckStringOf(jResp,"created_at")
creditor_bic.s = CkJsonObject::ckStringOf(jResp,"creditor_bic")
creditor_iban.s = CkJsonObject::ckStringOf(jResp,"creditor_iban")
creditor_name.s = CkJsonObject::ckStringOf(jResp,"creditor_name")
debitor_bic.s = CkJsonObject::ckStringOf(jResp,"debitor_bic")
debitor_address_line_1.s = CkJsonObject::ckStringOf(jResp,"debitor_address_line_1")
debitor_address_line2.s = CkJsonObject::ckStringOf(jResp,"debitor_address_line2")
debitor_country.s = CkJsonObject::ckStringOf(jResp,"debitor_country")
export_at.s = CkJsonObject::ckStringOf(jResp,"export_at")
export_error.s = CkJsonObject::ckStringOf(jResp,"export_error")
id.s = CkJsonObject::ckStringOf(jResp,"id")
remittance_information.s = CkJsonObject::ckStringOf(jResp,"remittance_information")
requested_at.s = CkJsonObject::ckStringOf(jResp,"requested_at")
updated_at.s = CkJsonObject::ckStringOf(jResp,"updated_at")
v_type.s = CkJsonObject::ckStringOf(jResp,"type")
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
CkStringBuilder::ckDispose(sbResponseBody)
CkJsonObject::ckDispose(jResp)
ProcedureReturn
EndProcedure
Curl Command
curl -X POST
-H "Authorization: {{apiKey}}"
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"document_id": "<long>",
"debitor_name": "<string>",
"debitor_iban": "<string>",
"mandate_id": "<string>",
"mandate_date_of_signature": "<date>",
"local_instrument": "COR1",
"sequence_type": "FRST",
"amount": "<integer>",
"reference": "<string>",
"created_at": "<dateTime>",
"creditor_bic": null,
"creditor_iban": "<string>",
"creditor_name": "<string>",
"debitor_bic": null,
"debitor_address_line_1": "<string>",
"debitor_address_line2": "<string>",
"debitor_country": "<string>",
"export_at": null,
"export_error": "<string>",
"id": "<long>",
"remittance_information": null,
"requested_at": "Today\'s date",
"updated_at": "<string>",
"type": "DEBIT"
}'
https://api.easybill.de/rest/v1/sepa-payments
Postman Collection Item JSON
{
"name": "Create SEPA payment",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"document_id\": \"<long>\",\n \"debitor_name\": \"<string>\",\n \"debitor_iban\": \"<string>\",\n \"mandate_id\": \"<string>\",\n \"mandate_date_of_signature\": \"<date>\",\n \"local_instrument\": \"COR1\",\n \"sequence_type\": \"FRST\",\n \"amount\": \"<integer>\",\n \"reference\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"creditor_bic\": null,\n \"creditor_iban\": \"<string>\",\n \"creditor_name\": \"<string>\",\n \"debitor_bic\": null,\n \"debitor_address_line_1\": \"<string>\",\n \"debitor_address_line2\": \"<string>\",\n \"debitor_country\": \"<string>\",\n \"export_at\": null,\n \"export_error\": \"<string>\",\n \"id\": \"<long>\",\n \"remittance_information\": null,\n \"requested_at\": \"Today's date\",\n \"updated_at\": \"<string>\",\n \"type\": \"DEBIT\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/sepa-payments",
"host": [
"{{baseUrl}}"
],
"path": [
"sepa-payments"
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"document_id\": \"<long>\",\n \"debitor_name\": \"<string>\",\n \"debitor_iban\": \"<string>\",\n \"mandate_id\": \"<string>\",\n \"mandate_date_of_signature\": \"<date>\",\n \"local_instrument\": \"COR1\",\n \"sequence_type\": \"FRST\",\n \"amount\": \"<integer>\",\n \"reference\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"creditor_bic\": null,\n \"creditor_iban\": \"<string>\",\n \"creditor_name\": \"<string>\",\n \"debitor_bic\": null,\n \"debitor_address_line_1\": \"<string>\",\n \"debitor_address_line2\": \"<string>\",\n \"debitor_country\": \"<string>\",\n \"export_at\": null,\n \"export_error\": \"<string>\",\n \"id\": \"<long>\",\n \"remittance_information\": null,\n \"requested_at\": \"Today's date\",\n \"updated_at\": \"<string>\",\n \"type\": \"DEBIT\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/sepa-payments",
"host": [
"{{baseUrl}}"
],
"path": [
"sepa-payments"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"document_id\": \"<long>\",\n \"debitor_name\": \"<string>\",\n \"debitor_iban\": \"<string>\",\n \"mandate_id\": \"<string>\",\n \"mandate_date_of_signature\": \"<date>\",\n \"local_instrument\": \"COR1\",\n \"sequence_type\": \"FRST\",\n \"amount\": \"<integer>\",\n \"reference\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"creditor_bic\": null,\n \"creditor_iban\": \"<string>\",\n \"creditor_name\": \"<string>\",\n \"debitor_bic\": null,\n \"debitor_address_line_1\": \"<string>\",\n \"debitor_address_line2\": \"<string>\",\n \"debitor_country\": \"<string>\",\n \"export_at\": null,\n \"export_error\": \"<string>\",\n \"id\": \"<long>\",\n \"remittance_information\": null,\n \"requested_at\": \"Today's date\",\n \"updated_at\": \"<string>\",\n \"type\": \"DEBIT\"\n}"
},
{
"name": "Too Many Requests",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"document_id\": \"<long>\",\n \"debitor_name\": \"<string>\",\n \"debitor_iban\": \"<string>\",\n \"mandate_id\": \"<string>\",\n \"mandate_date_of_signature\": \"<date>\",\n \"local_instrument\": \"COR1\",\n \"sequence_type\": \"FRST\",\n \"amount\": \"<integer>\",\n \"reference\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"creditor_bic\": null,\n \"creditor_iban\": \"<string>\",\n \"creditor_name\": \"<string>\",\n \"debitor_bic\": null,\n \"debitor_address_line_1\": \"<string>\",\n \"debitor_address_line2\": \"<string>\",\n \"debitor_country\": \"<string>\",\n \"export_at\": null,\n \"export_error\": \"<string>\",\n \"id\": \"<long>\",\n \"remittance_information\": null,\n \"requested_at\": \"Today's date\",\n \"updated_at\": \"<string>\",\n \"type\": \"DEBIT\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/sepa-payments",
"host": [
"{{baseUrl}}"
],
"path": [
"sepa-payments"
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}