Chilkat Online Tools

lianja / easybill REST API / Update SEPA payment

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loHttp = createobject("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>",
//   "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"
// }

loJson = createobject("CkJsonObject")
loJson.UpdateString("document_id","<long>")
loJson.UpdateString("debitor_name","<string>")
loJson.UpdateString("debitor_iban","<string>")
loJson.UpdateString("mandate_id","<string>")
loJson.UpdateString("mandate_date_of_signature","<date>")
loJson.UpdateString("local_instrument","COR1")
loJson.UpdateString("sequence_type","FRST")
loJson.UpdateString("amount","<integer>")
loJson.UpdateString("reference","<string>")
loJson.UpdateString("created_at","<dateTime>")
loJson.UpdateNull("creditor_bic")
loJson.UpdateString("creditor_iban","<string>")
loJson.UpdateString("creditor_name","<string>")
loJson.UpdateNull("debitor_bic")
loJson.UpdateString("debitor_address_line_1","<string>")
loJson.UpdateString("debitor_address_line2","<string>")
loJson.UpdateString("debitor_country","<string>")
loJson.UpdateNull("export_at")
loJson.UpdateString("export_error","<string>")
loJson.UpdateString("id","<long>")
loJson.UpdateNull("remittance_information")
loJson.UpdateString("requested_at","Today's date")
loJson.UpdateString("updated_at","<string>")
loJson.UpdateString("type","DEBIT")

loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("Authorization","{{apiKey}}")
loHttp.SetRequestHeader("Accept","application/json")

loSbRequestBody = createobject("CkStringBuilder")
loJson.EmitSb(loSbRequestBody)

loResp = loHttp.PTextSb("PUT","https://api.easybill.de/rest/v1/sepa-payments/:id",loSbRequestBody,"utf-8","application/json",.F.,.F.)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loJson
    release loSbRequestBody
    return
endif

loSbResponseBody = createobject("CkStringBuilder")
loResp.GetBodySb(loSbResponseBody)

loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    release loResp
    release loHttp
    release loJson
    release loSbRequestBody
    release loSbResponseBody
    release loJResp
    return
endif

release loResp

// 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

lcDocument_id = loJResp.StringOf("document_id")
lcDebitor_name = loJResp.StringOf("debitor_name")
lcDebitor_iban = loJResp.StringOf("debitor_iban")
lcMandate_id = loJResp.StringOf("mandate_id")
lcMandate_date_of_signature = loJResp.StringOf("mandate_date_of_signature")
lcLocal_instrument = loJResp.StringOf("local_instrument")
lcSequence_type = loJResp.StringOf("sequence_type")
lcAmount = loJResp.StringOf("amount")
lcReference = loJResp.StringOf("reference")
lcCreated_at = loJResp.StringOf("created_at")
lcCreditor_bic = loJResp.StringOf("creditor_bic")
lcCreditor_iban = loJResp.StringOf("creditor_iban")
lcCreditor_name = loJResp.StringOf("creditor_name")
lcDebitor_bic = loJResp.StringOf("debitor_bic")
lcDebitor_address_line_1 = loJResp.StringOf("debitor_address_line_1")
lcDebitor_address_line2 = loJResp.StringOf("debitor_address_line2")
lcDebitor_country = loJResp.StringOf("debitor_country")
lcExport_at = loJResp.StringOf("export_at")
lcExport_error = loJResp.StringOf("export_error")
lcId = loJResp.StringOf("id")
lcRemittance_information = loJResp.StringOf("remittance_information")
lcRequested_at = loJResp.StringOf("requested_at")
lcUpdated_at = loJResp.StringOf("updated_at")
lcV_type = loJResp.StringOf("type")


release loHttp
release loJson
release loSbRequestBody
release loSbResponseBody
release loJResp

Curl Command

curl -X PUT
	-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/:id

Postman Collection Item JSON

{
  "name": "Update SEPA payment",
  "request": {
    "method": "PUT",
    "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/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "sepa-payments",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of SEPA payment"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "PUT",
        "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/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_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": "Invalid SEPA payment",
      "originalRequest": {
        "method": "PUT",
        "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/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "PUT",
        "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/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sepa-payments",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}