Back to Collection Items
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# 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>",
# "amount": "<integer>",
# "id": "<long>",
# "is_overdue_fee": "<boolean>",
# "login_id": "<long>",
# "notice": "",
# "payment_at": "<date>",
# "type": "",
# "provider": "",
# "reference": ""
# }
set json [new_CkJsonObject]
CkJsonObject_UpdateString $json "document_id" "<long>"
CkJsonObject_UpdateString $json "amount" "<integer>"
CkJsonObject_UpdateString $json "id" "<long>"
CkJsonObject_UpdateString $json "is_overdue_fee" "<boolean>"
CkJsonObject_UpdateString $json "login_id" "<long>"
CkJsonObject_UpdateString $json "notice" ""
CkJsonObject_UpdateString $json "payment_at" "<date>"
CkJsonObject_UpdateString $json "type" ""
CkJsonObject_UpdateString $json "provider" ""
CkJsonObject_UpdateString $json "reference" ""
CkHttp_SetRequestHeader $http "Content-Type" "application/json"
CkHttp_SetRequestHeader $http "Authorization" "{{apiKey}}"
CkHttp_SetRequestHeader $http "Accept" "application/json"
# resp is a CkHttpResponse
set resp [CkHttp_PostJson3 $http "https://api.easybill.de/rest/v1/document-payments?paid=<boolean>" "application/json" $json]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkJsonObject $json
exit
}
set sbResponseBody [new_CkStringBuilder]
CkHttpResponse_GetBodySb $resp $sbResponseBody
set jResp [new_CkJsonObject]
CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0
puts "Response Body:"
puts [CkJsonObject_emit $jResp]
set respStatusCode [CkHttpResponse_get_StatusCode $resp]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
puts "Response Header:"
puts [CkHttpResponse_header $resp]
puts "Failed."
delete_CkHttpResponse $resp
delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp
exit
}
delete_CkHttpResponse $resp
# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)
# {
# "document_id": "<long>",
# "amount": "<integer>",
# "id": "<long>",
# "is_overdue_fee": "<boolean>",
# "login_id": "<long>",
# "notice": "",
# "payment_at": "<date>",
# "type": "",
# "provider": "",
# "reference": ""
# }
# Sample code for parsing the JSON response...
# Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
set document_id [CkJsonObject_stringOf $jResp "document_id"]
set amount [CkJsonObject_stringOf $jResp "amount"]
set id [CkJsonObject_stringOf $jResp "id"]
set is_overdue_fee [CkJsonObject_stringOf $jResp "is_overdue_fee"]
set login_id [CkJsonObject_stringOf $jResp "login_id"]
set notice [CkJsonObject_stringOf $jResp "notice"]
set payment_at [CkJsonObject_stringOf $jResp "payment_at"]
set v_type [CkJsonObject_stringOf $jResp "type"]
set provider [CkJsonObject_stringOf $jResp "provider"]
set reference [CkJsonObject_stringOf $jResp "reference"]
delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp
Curl Command
curl -X POST
-H "Authorization: {{apiKey}}"
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"document_id": "<long>",
"amount": "<integer>",
"id": "<long>",
"is_overdue_fee": "<boolean>",
"login_id": "<long>",
"notice": "",
"payment_at": "<date>",
"type": "",
"provider": "",
"reference": ""
}'
https://api.easybill.de/rest/v1/document-payments?paid=<boolean>
Postman Collection Item JSON
{
"name": "Create document 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 \"amount\": \"<integer>\",\n \"id\": \"<long>\",\n \"is_overdue_fee\": \"<boolean>\",\n \"login_id\": \"<long>\",\n \"notice\": \"\",\n \"payment_at\": \"<date>\",\n \"type\": \"\",\n \"provider\": \"\",\n \"reference\": \"\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/document-payments?paid=<boolean>",
"host": [
"{{baseUrl}}"
],
"path": [
"document-payments"
],
"query": [
{
"key": "paid",
"value": "<boolean>",
"description": "Mark document as paid when amount less then payment amount."
}
]
}
},
"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 \"amount\": \"<integer>\",\n \"id\": \"<long>\",\n \"is_overdue_fee\": \"<boolean>\",\n \"login_id\": \"<long>\",\n \"notice\": \"\",\n \"payment_at\": \"<date>\",\n \"type\": \"\",\n \"provider\": \"\",\n \"reference\": \"\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/document-payments?paid=<boolean>",
"host": [
"{{baseUrl}}"
],
"path": [
"document-payments"
],
"query": [
{
"key": "paid",
"value": "<boolean>",
"description": "Mark document as paid when amount less then payment amount."
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"document_id\": \"<long>\",\n \"amount\": \"<integer>\",\n \"id\": \"<long>\",\n \"is_overdue_fee\": \"<boolean>\",\n \"login_id\": \"<long>\",\n \"notice\": \"\",\n \"payment_at\": \"<date>\",\n \"type\": \"\",\n \"provider\": \"\",\n \"reference\": \"\"\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 \"amount\": \"<integer>\",\n \"id\": \"<long>\",\n \"is_overdue_fee\": \"<boolean>\",\n \"login_id\": \"<long>\",\n \"notice\": \"\",\n \"payment_at\": \"<date>\",\n \"type\": \"\",\n \"provider\": \"\",\n \"reference\": \"\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/document-payments?paid=<boolean>",
"host": [
"{{baseUrl}}"
],
"path": [
"document-payments"
],
"query": [
{
"key": "paid",
"value": "<boolean>",
"description": "Mark document as paid when amount less then payment amount."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}