DocumentService :: InsertReglements

The POST method, is used to retrieve data.

The list of parameters is not mandatory to request:

  • String numDocument,
  • TypeDocument typeDocument,
  • IList<Reglement> reglementList

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

Input parameters:

{
  "numDocument": "FA00015",
  "typeDocument": 1,
  "reglementList": [
    {
      "Id": 0,
      "Valeur": 10,
      "TypeValeur": 0,
      "MontantDevise": 0,
      "Date": "/Date(1490457287000+0100)/",
      "Libelle": "Reglement 34",
      "IdModeReglement": 1,
      "Regle": true
    }
  ]
}

Example:

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

use services\Reglement;
use services\WebServices100;

// add parameters
$reg = new Reglement();

$reg->setId(0);
$reg->setValeur(10);
$reg->setTypeValeur(0);
$reg->setMontantDevise(0);
$reg->setDate();
$reg->setLibelle("Reglement 34");
$reg->setIdModeReglement(1);
$reg->setRegle(true);

$data = new stdClass();
//$data->ecriture = new stdClass();
$data->numDocument = "FA00015";
$data->typeDocument = 1;

$data->reglementList[] = $reg->getResponse();

$json_data = json_encode($data, JSON_UNESCAPED_SLASHES);

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

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

$response= json_decode($result);

Result:

Array of Reglement