CollaborateurService :: Insert

The POST method, is used to retrieve data.

The list of necessary parameters for sending a query:

  • Collaborateur collaborateur

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

Input parameters:

{"collaborateur":{
"Nom":"DLJFJDLFKJD",
"Prenom":"Dfjslfjldskjfls",
"Service":"Dljfsdlkjfld",
"Fonction":"Dvnjdfsglmsdflfds",
"Adresse":"52, akdshfjkljadsfljadslf",
"CodePostal":69000,
"Ville":0,
"EstChargeRecouvrement":1}
}

Example:

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

use services\Collaborateur;
use services\Webservices100;

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

// add parameters
$coll = new Collaborateur();

$coll->setId(0);
$coll->setNom('DLJFJDLFKJD');
$coll->setPrenom('Dfjslfjldskjfls');
$coll->setService('Dljfsdlkjfld');
$coll->setMatricule();
$coll->setFonction('Dvnjdfsglmsdflfds');
$coll->setAdresse('52, akdshfjkljadsfljadslf ');
$coll->setComplement();
$coll->setCodePostal(69000);
$coll->setVille('Lyon');
$coll->setRegion();
$coll->setPays();
$coll->setTelephone();
$coll->setGsm();
$coll->setEmail();
$coll->setEstVendeur();
$coll->setEstCaissier();
$coll->setEstControleur();
$coll->setEstAcheteur();
$coll->setEstChargeRecouvrement(1);
$coll->setEstResponsableFinancier();

$data = $coll->getResponse();
$data_json = json_encode($data);

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

$response = json_decode($result);

Result:

stdClass Object
(
    [Id] => 12
    [Nom] => DLJFJDLFKJD
    [Prenom] => Dfjslfjldskjfls
    [Service] => Dljfsdlkjfld
    [Matricule] => 
    [Fonction] => Dvnjdfsglmsdflfds
    [Adresse] => 52, akdshfjkljadsfljadslf 
    [Complement] => 
    [CodePostal] => 69000
    [Ville] => 0
    [Region] => 
    [Pays] => 
    [Telephone] => 
    [Fax] => 
    [Gsm] => 
    [Email] => 
    [EstVendeur] => 
    [EstCaissier] => 
    [EstControleur] => 
    [EstAcheteur] => 
    [EstChargeRecouvrement] => 1
    [EstResponsableFinancier] => 
)