Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_Date
string ls_Description
string ls_Kind
string ls_V_Type
string ls_Entity_name
string ls_DocumentId
string ls_DocumentType
string ls_Path
string ls_Amount_in
string ls_Payment_account_inId
string ls_Name
string ls_Payment_account_inType
string ls_Iban
string ls_Sia
string ls_Cuc
string ls_V_Virtual
string ls_Amount_out
string ls_Payment_account_outId
string ls_Payment_account_outName
string ls_Payment_account_outType
string ls_Payment_account_outIban
string ls_Payment_account_outSia
string ls_Payment_account_outCuc
string ls_Payment_account_outVirtual
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "data": {
// "id": "<string>",
// "date": "<date>",
// "description": "<string>",
// "kind": "receipt",
// "type": "out",
// "entity_name": "<string>",
// "document": {
// "id": "<integer>",
// "type": "<string>",
// "path": "<string>"
// },
// "amount_in": "<number>",
// "payment_account_in": {
// "name": "<string>",
// "id": "<integer>",
// "type": "standard",
// "iban": "<string>",
// "sia": "<string>",
// "cuc": "<string>",
// "virtual": "<boolean>"
// },
// "amount_out": "<number>",
// "payment_account_out": {
// "name": "<string>",
// "id": "<integer>",
// "type": "standard",
// "iban": "<string>",
// "sia": "<string>",
// "cuc": "<string>",
// "virtual": "<boolean>"
// }
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("data.id","<string>")
loo_Json.UpdateString("data.date","<date>")
loo_Json.UpdateString("data.description","<string>")
loo_Json.UpdateString("data.kind","receipt")
loo_Json.UpdateString("data.type","out")
loo_Json.UpdateString("data.entity_name","<string>")
loo_Json.UpdateString("data.document.id","<integer>")
loo_Json.UpdateString("data.document.type","<string>")
loo_Json.UpdateString("data.document.path","<string>")
loo_Json.UpdateString("data.amount_in","<number>")
loo_Json.UpdateString("data.payment_account_in.name","<string>")
loo_Json.UpdateString("data.payment_account_in.id","<integer>")
loo_Json.UpdateString("data.payment_account_in.type","standard")
loo_Json.UpdateString("data.payment_account_in.iban","<string>")
loo_Json.UpdateString("data.payment_account_in.sia","<string>")
loo_Json.UpdateString("data.payment_account_in.cuc","<string>")
loo_Json.UpdateString("data.payment_account_in.virtual","<boolean>")
loo_Json.UpdateString("data.amount_out","<number>")
loo_Json.UpdateString("data.payment_account_out.name","<string>")
loo_Json.UpdateString("data.payment_account_out.id","<integer>")
loo_Json.UpdateString("data.payment_account_out.type","standard")
loo_Json.UpdateString("data.payment_account_out.iban","<string>")
loo_Json.UpdateString("data.payment_account_out.sia","<string>")
loo_Json.UpdateString("data.payment_account_out.cuc","<string>")
loo_Json.UpdateString("data.payment_account_out.virtual","<boolean>")
loo_Http.SetRequestHeader("Content-Type","application/json")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.PostJson3("https://api-v2.fattureincloud.it/c/:company_id/cashbook","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_Json
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "data": {
// "id": "<string>",
// "date": "<date>",
// "description": "<string>",
// "kind": "tax",
// "type": "in",
// "entity_name": "<string>",
// "document": {
// "id": "<integer>",
// "type": "<string>",
// "path": "<string>"
// },
// "amount_in": "<number>",
// "payment_account_in": {
// "id": "<integer>",
// "name": "<string>",
// "type": "standard",
// "iban": "<string>",
// "sia": "<string>",
// "cuc": "<string>",
// "virtual": "<boolean>"
// },
// "amount_out": "<number>",
// "payment_account_out": {
// "id": "<integer>",
// "name": "<string>",
// "type": "standard",
// "iban": "<string>",
// "sia": "<string>",
// "cuc": "<string>",
// "virtual": "<boolean>"
// }
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Id = loo_JResp.StringOf("data.id")
ls_Date = loo_JResp.StringOf("data.date")
ls_Description = loo_JResp.StringOf("data.description")
ls_Kind = loo_JResp.StringOf("data.kind")
ls_V_Type = loo_JResp.StringOf("data.type")
ls_Entity_name = loo_JResp.StringOf("data.entity_name")
ls_DocumentId = loo_JResp.StringOf("data.document.id")
ls_DocumentType = loo_JResp.StringOf("data.document.type")
ls_Path = loo_JResp.StringOf("data.document.path")
ls_Amount_in = loo_JResp.StringOf("data.amount_in")
ls_Payment_account_inId = loo_JResp.StringOf("data.payment_account_in.id")
ls_Name = loo_JResp.StringOf("data.payment_account_in.name")
ls_Payment_account_inType = loo_JResp.StringOf("data.payment_account_in.type")
ls_Iban = loo_JResp.StringOf("data.payment_account_in.iban")
ls_Sia = loo_JResp.StringOf("data.payment_account_in.sia")
ls_Cuc = loo_JResp.StringOf("data.payment_account_in.cuc")
ls_V_Virtual = loo_JResp.StringOf("data.payment_account_in.virtual")
ls_Amount_out = loo_JResp.StringOf("data.amount_out")
ls_Payment_account_outId = loo_JResp.StringOf("data.payment_account_out.id")
ls_Payment_account_outName = loo_JResp.StringOf("data.payment_account_out.name")
ls_Payment_account_outType = loo_JResp.StringOf("data.payment_account_out.type")
ls_Payment_account_outIban = loo_JResp.StringOf("data.payment_account_out.iban")
ls_Payment_account_outSia = loo_JResp.StringOf("data.payment_account_out.sia")
ls_Payment_account_outCuc = loo_JResp.StringOf("data.payment_account_out.cuc")
ls_Payment_account_outVirtual = loo_JResp.StringOf("data.payment_account_out.virtual")
destroy loo_Http
destroy loo_Json
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"data": {
"id": "<string>",
"date": "<date>",
"description": "<string>",
"kind": "receipt",
"type": "out",
"entity_name": "<string>",
"document": {
"id": "<integer>",
"type": "<string>",
"path": "<string>"
},
"amount_in": "<number>",
"payment_account_in": {
"name": "<string>",
"id": "<integer>",
"type": "standard",
"iban": "<string>",
"sia": "<string>",
"cuc": "<string>",
"virtual": "<boolean>"
},
"amount_out": "<number>",
"payment_account_out": {
"name": "<string>",
"id": "<integer>",
"type": "standard",
"iban": "<string>",
"sia": "<string>",
"cuc": "<string>",
"virtual": "<boolean>"
}
}
}'
https://api-v2.fattureincloud.it/c/:company_id/cashbook
Postman Collection Item JSON
{
"name": "Create Cashbook Entry",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "scope",
"value": "entity.clients:r entity.clients:a entity.suppliers:r entity.suppliers:a products:r products:a issued_documents.invoices:r issued_documents.credit_notes:r issued_documents.receipts:r issued_documents.orders:r issued_documents.quotes:r issued_documents.proformas:r issued_documents.delivery_notes:r issued_documents.work_reports:r issued_documents.supplier_orders:r issued_documents.self_invoices:r issued_documents.invoices:a issued_documents.credit_notes:a issued_documents.receipts:a issued_documents.orders:a issued_documents.quotes:a issued_documents.proformas:a issued_documents.delivery_notes:a issued_documents.work_reports:a issued_documents.supplier_orders:a issued_documents.self_invoices:a received_documents:r received_documents:a stock:r stock:a receipts:r receipts:a taxes:r taxes:a archive:r archive:a cashbook:r cashbook:a settings:r settings:a situation:r",
"type": "string"
},
{
"key": "redirect_uri",
"value": "https://api-v2.fattureincloud.it/oauth/token",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "https://api-v2.fattureincloud.it/oauth/token",
"type": "string"
},
{
"key": "authUrl",
"value": "https://api-v2.fattureincloud.it/oauth/authorize",
"type": "string"
},
{
"key": "grant_type",
"value": "authorization_code",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"id\": \"<string>\",\n \"date\": \"<date>\",\n \"description\": \"<string>\",\n \"kind\": \"receipt\",\n \"type\": \"out\",\n \"entity_name\": \"<string>\",\n \"document\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"path\": \"<string>\"\n },\n \"amount_in\": \"<number>\",\n \"payment_account_in\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n },\n \"amount_out\": \"<number>\",\n \"payment_account_out\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n }\n }\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/c/:company_id/cashbook",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"cashbook"
],
"variable": [
{
"key": "company_id",
"value": "<integer>"
}
]
},
"description": "Creates a new cashbook entry."
},
"response": [
{
"name": "The created Cashbook Entry.",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"id\": \"<string>\",\n \"date\": \"<date>\",\n \"description\": \"<string>\",\n \"kind\": \"receipt\",\n \"type\": \"out\",\n \"entity_name\": \"<string>\",\n \"document\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"path\": \"<string>\"\n },\n \"amount_in\": \"<number>\",\n \"payment_account_in\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n },\n \"amount_out\": \"<number>\",\n \"payment_account_out\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n }\n }\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/c/:company_id/cashbook",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"cashbook"
],
"variable": [
{
"key": "company_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": {\n \"id\": \"<string>\",\n \"date\": \"<date>\",\n \"description\": \"<string>\",\n \"kind\": \"tax\",\n \"type\": \"in\",\n \"entity_name\": \"<string>\",\n \"document\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"path\": \"<string>\"\n },\n \"amount_in\": \"<number>\",\n \"payment_account_in\": {\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n },\n \"amount_out\": \"<number>\",\n \"payment_account_out\": {\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n }\n }\n}"
},
{
"name": "Unauthorized",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"id\": \"<string>\",\n \"date\": \"<date>\",\n \"description\": \"<string>\",\n \"kind\": \"receipt\",\n \"type\": \"out\",\n \"entity_name\": \"<string>\",\n \"document\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"path\": \"<string>\"\n },\n \"amount_in\": \"<number>\",\n \"payment_account_in\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n },\n \"amount_out\": \"<number>\",\n \"payment_account_out\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n }\n }\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/c/:company_id/cashbook",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"cashbook"
],
"variable": [
{
"key": "company_id"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_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: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"id\": \"<string>\",\n \"date\": \"<date>\",\n \"description\": \"<string>\",\n \"kind\": \"receipt\",\n \"type\": \"out\",\n \"entity_name\": \"<string>\",\n \"document\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"path\": \"<string>\"\n },\n \"amount_in\": \"<number>\",\n \"payment_account_in\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n },\n \"amount_out\": \"<number>\",\n \"payment_account_out\": {\n \"name\": \"<string>\",\n \"id\": \"<integer>\",\n \"type\": \"standard\",\n \"iban\": \"<string>\",\n \"sia\": \"<string>\",\n \"cuc\": \"<string>\",\n \"virtual\": \"<boolean>\"\n }\n }\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/c/:company_id/cashbook",
"host": [
"{{baseUrl}}"
],
"path": [
"c",
":company_id",
"cashbook"
],
"variable": [
{
"key": "company_id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}