Function to update a invoice
https://rest.crmango.com/api/UpdateInvoice
Bearer
varchar
Auth token
invoice_id
integer
Invoice id
name
varchar
Invoice name
created_at
timestamp
Created date
status_id
integer
Invoice status
0 - Created
1 - Fully paid
2 - Completely credited
3 - Partially paid
4 - Paid
5 - Cancelled
var_symbol
varchar
Variable symbol
due_date
timestamp
Due date
taxable_date
timestamp
Taxable date
note
varchar
Note
file_url
varchar
Invoice pdf url
paid
integer|float
Already paid
products[][product_id]
integer
Product id
products[][name]
varchar
Product name
products[][quantity]
integer
Quantity
products[][price]
integer|float
Quantity
products[][cost_price]
integer|float
Cost price
products[][vat]
integer
VAT
products[][discount]
integer
Discount
Function to update a invoice
code
integer
Return code
message
varchar
Info message
curl --request PUT \
--url 'https://rest.crmango.com/api/UpdateInvoice' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"invoice_id": 21,
"name": "Faktura 1-2",
"rad_code": "PP",
"supplier_id": 123,
"purchaser_fa_id": 123,
"created_at": 1673267509,
"currency_id": 202,
"status_id": 1,
"user_id": 7,
"active_service_id": 0,
"var_symbol": "1223",
"due_date": 1673267509,
"taxable_date": 1673267509,
"note": "Test",
"file_url": "",
"paid": 5,
"products": [
{
"product_id": 19,
"name": "Grafická karta 1080",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 50
},
{
"product_id": 20,
"name": "Grafická karta",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 0
}
]
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/UpdateInvoice',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
"data": {
"invoice_id": 21,
"name": "Faktura 1-2",
"rad_code": "PP",
"supplier_id": 123,
"purchaser_fa_id": 123,
"created_at": 1673267509,
"currency_id": 202,
"status_id": 1,
"user_id": 7,
"active_service_id": 0,
"var_symbol": "1223",
"due_date": 1673267509,
"taxable_date": 1673267509,
"note": "Test",
"file_url": "",
"paid": 5,
"products": [
{
"product_id": 19,
"name": "Grafická karta 1080",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 50
},
{
"product_id": 20,
"name": "Grafická karta",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 0
}
]
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
"data": {
"invoice_id": 21,
"name": "Faktura 1-2",
"rad_code": "PP",
"supplier_id": 123,
"purchaser_fa_id": 123,
"created_at": 1673267509,
"currency_id": 202,
"status_id": 1,
"user_id": 7,
"active_service_id": 0,
"var_symbol": "1223",
"due_date": 1673267509,
"taxable_date": 1673267509,
"note": "Test",
"file_url": "",
"paid": 5,
"products": [
{
"product_id": 19,
"name": "Grafická karta 1080",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 50
},
{
"product_id": 20,
"name": "Grafická karta",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 0
}
]
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "https://rest.crmango.com/api/UpdateInvoice");
xhr.setRequestHeader("Authorization", "Bearer auth_token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
import requests
import json
url = "https://rest.crmango.com/api/UpdateInvoice"
payload = json.dumps({
"data": {
"invoice_id": 21,
"name": "Faktura 1-2",
"rad_code": "PP",
"supplier_id": 123,
"purchaser_fa_id": 123,
"created_at": 1673267509,
"currency_id": 202,
"status_id": 1,
"user_id": 7,
"active_service_id": 0,
"var_symbol": "1223",
"due_date": 1673267509,
"taxable_date": 1673267509,
"note": "Test",
"file_url": "",
"paid": 5,
"products": [
{
"product_id": 19,
"name": "Grafická karta 1080",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 50
},
{
"product_id": 20,
"name": "Grafická karta",
"quantity": 2,
"price": 2,
"cost_price": 100,
"vat": 20,
"discount": 0
}
]
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
{
"code": 200,
"message": "Invoice has been updated"
}
{
"code": "int",
"message": "string"
}