Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "to": "<string>",
// "cc": "<string>",
// "from": "<string>",
// "subject": "<string>",
// "message": "<string>",
// "date": "<date>",
// "send_by_self": "<boolean>",
// "send_with_attachment": "true",
// "document_file_type": "default",
// "post_send_type": "post_send_type_prio"
// }
var json = new chilkat.JsonObject();
json.UpdateString("to","<string>");
json.UpdateString("cc","<string>");
json.UpdateString("from","<string>");
json.UpdateString("subject","<string>");
json.UpdateString("message","<string>");
json.UpdateString("date","<date>");
json.UpdateString("send_by_self","<boolean>");
json.UpdateString("send_with_attachment","true");
json.UpdateString("document_file_type","default");
json.UpdateString("post_send_type","post_send_type_prio");
http.SetRequestHeader("Authorization","{{apiKey}}");
http.SetRequestHeader("Content-Type","application/json");
// resp: HttpResponse
var resp = http.PostJson3("https://api.easybill.de/rest/v1/documents/:id/send/:type","application/json",json);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
var respStatusCode = resp.StatusCode;
console.log("Response Status Code = " + respStatusCode);
if (respStatusCode !== 204) {
console.log("Response Header:");
console.log(resp.Header);
console.log("Response Body:");
console.log(resp.BodyStr);
console.log("Failed.");
return;
}
console.log("Success.");
}
chilkatExample();
Curl Command
curl -X POST
-H "Authorization: {{apiKey}}"
-H "Content-Type: application/json"
-d '{
"to": "<string>",
"cc": "<string>",
"from": "<string>",
"subject": "<string>",
"message": "<string>",
"date": "<date>",
"send_by_self": "<boolean>",
"send_with_attachment": "true",
"document_file_type": "default",
"post_send_type": "post_send_type_prio"
}'
https://api.easybill.de/rest/v1/documents/:id/send/:type
Postman Collection Item JSON
{
"name": "Send document",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"to\": \"<string>\",\n \"cc\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"date\": \"<date>\",\n \"send_by_self\": \"<boolean>\",\n \"send_with_attachment\": \"true\",\n \"document_file_type\": \"default\",\n \"post_send_type\": \"post_send_type_prio\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/documents/:id/send/:type",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"send",
":type"
],
"variable": [
{
"key": "id",
"value": "<long>",
"description": "(Required) ID of document"
},
{
"key": "type",
"value": "fax",
"description": "(Required) "
}
]
}
},
"response": [
{
"name": "Successful operation",
"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 \"to\": \"<string>\",\n \"cc\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"date\": \"<date>\",\n \"send_by_self\": \"<boolean>\",\n \"send_with_attachment\": \"true\",\n \"document_file_type\": \"default\",\n \"post_send_type\": \"post_send_type_prio\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/documents/:id/send/:type",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"send",
":type"
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
},
{
"name": "Not found",
"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 \"to\": \"<string>\",\n \"cc\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"date\": \"<date>\",\n \"send_by_self\": \"<boolean>\",\n \"send_with_attachment\": \"true\",\n \"document_file_type\": \"default\",\n \"post_send_type\": \"post_send_type_prio\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/documents/:id/send/:type",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"send",
":type"
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
},
{
"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 \"to\": \"<string>\",\n \"cc\": \"<string>\",\n \"from\": \"<string>\",\n \"subject\": \"<string>\",\n \"message\": \"<string>\",\n \"date\": \"<date>\",\n \"send_by_self\": \"<boolean>\",\n \"send_with_attachment\": \"true\",\n \"document_file_type\": \"default\",\n \"post_send_type\": \"post_send_type_prio\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/documents/:id/send/:type",
"host": [
"{{baseUrl}}"
],
"path": [
"documents",
":id",
"send",
":type"
],
"variable": [
{
"key": "id"
},
{
"key": "type"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}