I want to validate invoice with api
creat invoice work, invoice id = 29
but validate the invoice failed :
http://myurl_dolibar_api/invoices/29/validate
could you help me
//
// Code
//
// Create an invoice
$newFacture = [
“ref” => $facture_ref,
“ref_client” => $facture_lib,
“socid” => $socid,
“contact_id” => $contact_id,
“fk_project” => $project_id,
“type” => “0”, // commande client
“cond_reglement_id” => 6, // 6=‘A la commande’ ; 5=‘60 jours fin de mois’ - cf. http://www.clotilderanno.com/dolibarr/admin/dict.php?id=12
“mode_reglement_id” => 6, // 6='Carte Bancaire
“demand_reason_id” => 8, // 8=‘Bouche à oreille’
“availability_id” => 5, // 5=‘1 mois’ ; 4=‘3 semaines’ -cf. http://localhost/dolibarr/admin/dict.php?id=21
“fk_account” => 1, // 1=‘SAS Clotilde Ranno’
“date” => “2017-07-27”, // ??
“date_commande” => “2017-07-27”, // ??
“date_livraison” => “2017-08-28”, // ??
“lines” => $newCommandeLine,
“note_private” => “order created automatically with API”,
];
//"user_valid" =\> 1,
//"fk_user_valid" =\> 1,
echo "\n\r--------------------\- facture creation input : \n\r";
print_r(json_encode($newFacture));
echo "\n\r new invoice end. \n\r";
$newFactureResult = CallAPI("POST", $token, $dolibarr_endpointUrl."/invoices", json_encode($newFacture ));
$newFactureResult = json_decode($newFactureResult, true);
echo "\n\r--------------------\- facture creation answer : \n\r";
print_r($newFactureResult);
echo "\n\r facture order end. \n\r";
// Validate an invoice
$newFactureValider = [
"idwarehouse" =\> "0",
"notrigger" =\> "0"
];
$newFactureValiderResult = CallAPI("POST", $token, $dolibarr_endpointUrl."/invoices/".$newFactureResult."/validate", json_encode($newFactureValider));
$newFactureValiderResult = json_decode($newFactureValiderResult, true);
echo "\n\r--------------------\- facture creation answer for validation : \n\r";
print_r($newFactureValiderResult);
echo "\n\r end !!!! \n\r";
//
// Result
//
--------------------- facture creation answer :
22
facture order end.
--------------------- facture creation answer for validation :
Array
(
[error] => Array
(
[code]
=> 404
[message] => Not Found
)
)