DocumentService :: InsertDocument

The POST method, is used to retrieve data.

The list of necessary parameters for sending a query:

  • Document document
  • bool useSageProcess = true

Returns data as JSON, for use in PHP, you need to convert JSON in StdClass PHP (PHP function: json_decode ()).

Input parameters:

{"document":
{"__type":"DocumentVente:http:\/\/www.proconsult.lu\/WebServices100",
"Domaine":0,
"NumeroDocument":"BC00028a",
"Date":"\/Date(1490057505000+0100)\/",
"Reference":"LOC 03\/2015",
"NumeroTiers":"DIAMA",
"NumeroTiersPayeur":"DIAMA",
"Statut":2,"Provenance":0,
"DateLivraison":"\/Date(1426201200000+0100)\/",
"DateLivraisonRealisee":"\/Date(-2208992400000+0100)\/",
"DateExpedition":"\/Date(-2208992400000+0100)\/",
"SectionAnalytique":"950BIJO",
"Contact":"",
"NbFactures":1,
"NbColis":1,
"TauxEscompte":0,
"Langue":0,
"Donnee1":"",
"Donnee2":"",
"Donnee3":"",
"Donnee4":"",
"EstImprime":false,
"EstTransfere":false,
"EstCloture":false,
"EstReliquat":false,
"IdSouche":0,
"IdCollaborateur":10,
"IdDepot":1,
"IdAdresseLivraison":10,
"IdModeExpedition":1,
"IdConditionLivraison":1,
"IdCategorieComptable":1,
"IdCategorieTarifaire":1,
"IdModeleReglement":0,
"IdDevise":0,
"CoursDevise":0,
"FraisExpedition":14,
"TypeFraisExpedition":0,
"TypePrixFraisExpedition":0,
"FrancoDePort":4500,
"TypeFrancoPort":0,
"TypePrixFrancoPort":0,
"ExpeditionCodeTaxe1":"C20",
"ExpeditionCodeTaxe2":null,
"ExpeditionCodeTaxe3":null,
"ExpeditionTaux1":20,
"ExpeditionTaux2":0,
"ExpeditionTaux3":0}
}

Example:

require (__DIR__ . '/service/Document.php');

use services\Document;
use services\Webservices100;

$url = 'http://<Your ip>:<Your Port>/WebServices100/<Your environment>/DocumentService/rest/InsertDocument';

$doc = new Document();

$doc->setType("DocumentVente:http://www.proconsult.lu/WebServices100");
$doc->setDomaine(0);
$doc->setNumeroDocument("BC00028a");
$doc->setReference("LOC 03/2015");
$doc->setDate("/Date(".time()."000+0100)/");
$doc->setNumeroTiers("DIAMA");
$doc->setNumeroTiersPayeur("DIAMA");
$doc->setStatut(2);
$doc->setProvenance(0);
$doc->setDateLivraison("/Date(1426201200000+0100)/");
$doc->setDateLivraisonRealisee("/Date(-2208992400000+0100)/");
$doc->setDateExpedition("/Date(-2208992400000+0100)/");
$doc->setContact("");
$doc->setSectionAnalytique("950BIJO");
$doc->setNbFactures(1);
$doc->setNbColis(1);
$doc->setTauxEscompte(0);
$doc->setLangue(0);
$doc->setDonnee1("");
$doc->setDonnee2("");
$doc->setDonnee3("");
$doc->setDonnee4("");
$doc->setEstImprime(false);
$doc->setEstTransfere(false);
$doc->setEstCloture(false);
$doc->setEstReliquat(false);
$doc->setIdSouche(0);
$doc->setIdCollaborateur(10);
$doc->setIdDepot(1);
$doc->setIdAdresseLivraison(10);
$doc->setIdModeExpedition(1);
$doc->setIdConditionLivraison(1);
$doc->setIdCategorieComptable(1);
$doc->setIdCategorieTarifaire(1);
$doc->setIdModeleReglement(0);
$doc->setIdDevise(0);
$doc->setCoursDevise(0);
$doc->setFraisExpedition(14);
$doc->setTypeFraisExpedition(0);
$doc->setTypePrixFraisExpedition(0);
$doc->setFrancoDePort(4500);
$doc->setTypeFrancoPort(0);
$doc->setTypePrixFrancoPort(0);
$doc->setExpeditionCodeTaxe1("C20");
$doc->setExpeditionCodeTaxe2(null);
$doc->setExpeditionCodeTaxe3(null);
$doc->setExpeditionTaux1(20);
$doc->setExpeditionTaux2(0);
$doc->setExpeditionTaux3(0);

$data = $doc->getResponse();

$json_data = json_encode($data);

// Send requests to receive data
$result = WebServices100::getData($url, $json_data);

$response = json_decode($result);

Result:

BC00028