ArticleService :: Insert

The POST method, is used to retrieve data.

The list of necessary parameters for sending a query:

  • Article article

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

Input parameters:

{"article":
{
"__type":"ArticleStandard:http:\/\/www.proconsult.lu\/WebServices100",
"TypeArticle":0,
"Reference":"TESTARTICLE3",
"Intitule":"Bague Argentd",
"CodeFamille":"BIJOUXARG",
"TypeNomenclature":0,
"TypeSuiviStock":0,
"TypeEscompte":0,
"UnitePoids":0,
"PoidsNet":4.28,
"PoidsBrut":15,
"IdUniteVente":1,
"DelaiLivraison":0,
"Garantie":36,
"PrixAchat":280,
"PrixUnitaireNet":0,
"PrixVente":372,
"Coefficient":2,
"Statistique1":"Automne\/Hiver",
"Statistique2":"Classique",
"Statistique3":"",
"Statistique4":"",
"Statistique5":"",
"EstEnSommeil":false,
"Langue1":"Silver ring",
"Langue2":"",
"IdCatalogue1":5,
"IdCatalogue2":6,
"IdCatalogue3":7,
"IdCatalogue4":0,
"HorsStatistique":false,
"VenteAuDebit":false,
"NonImpression":false,
"Contremarque":false,
"FacturationPoids":false,
"FacturationForfait":false,
"Transfere":false,
"Publie":true,
"InfosLibres":[
{"Name":"Pourcentage teneur en or",
"Type":3,
"Size":0,
"EstCalculee":false,
"Value":0}]}
}

Example:

require (__DIR__ . '/service/Article.php');
require (__DIR__ . '/service/InfoLibre.php');

use services\Article;
use services\InfoLibre;
use services\Webservices100;

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

// add parameters
$infosLibres = new InfoLibre();

$infosLibres->setName("Pourcentage teneur en or");
$infosLibres->setType(3);
$infosLibres->setSize(0);
$infosLibres->setEstCalculee(false);
$infosLibres->setValue(0);

$article = new Article(0);

$article->setType('ArticleStandard:http://www.proconsult.lu/WebServices100');
$article->setReference('TESTARTICLE3');
$article->setIntitule('Bague Argentd');
$article->setCodeFamille('BIJOUXARG');
$article->setTypeArticle(0);
$article->setTypeNomenclature(0);
$article->setTypeSuiviStock(0);
$article->setTypeEscompte(0);
$article->setUnitePoids(0);
$article->setPoidsNet(4.28);
$article->setPoidsBrut(15);
$article->setIdUniteVente(1);
$article->setDelaiLivraison(0);
$article->setGarantie(36);
$article->setPrixAchat(280);
$article->setPrixUnitaireNet(0);
$article->setPrixVente(372);
$article->setCoefficient(2);
$article->setStatistique1("Automne/Hiver");
$article->setStatistique2("Classique");
$article->setStatistique3("");
$article->setStatistique4("");
$article->setStatistique5("");
$article->setEstEnSommeil(false);
$article->setCodeBarres(null);
$article->setLangue1("Silver ring");
$article->setLangue2("");
$article->setIdCatalogue1(5);
$article->setIdCatalogue2(6);
$article->setIdCatalogue3(7);
$article->setIdCatalogue4(0);
$article->setHorsStatistique(false);
$article->setVenteAuDebit(false);
$article->setNonImpression(false);
$article->setContremarque(false);
$article->setFacturationPoids(false);
$article->setFacturationForfait(false);
$article->setTransfere(false);
$article->setPublie(true);
$article->setInfosLibres([$infosLibres->getResponse()]);

$data = $article->getResponse();

$json_data = json_encode($data);

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

$response = json_decode($result);

Result:

stdClass Object
(
    [__type] => ArticleStandard:http://www.proconsult.lu/WebServices100
    [Reference] => TESTARTICLE3
    [Intitule] => Bague Argentd
    [CodeFamille] => BIJOUXARG
    [TypeArticle] => 0
    [TypeNomenclature] => 0
    [TypeSuiviStock] => 0
    [TypeEscompte] => 0
    [UnitePoids] => 0
    [PoidsNet] => 4.28
    [PoidsBrut] => 15
    [IdUniteVente] => 1
    [DelaiLivraison] => 0
    [Garantie] => 12
    [PrixAchat] => 280
    [PrixUnitaireNet] => 0
    [PrixVente] => 372
    [Coefficient] => 2
    [Statistique1] => Automne/Hiver
    [Statistique2] => 
    [Statistique3] => 
    [Statistique4] => 
    [Statistique5] => 
    [EstEnSommeil] => 
    [Langue1] => Silver ring
    [Langue2] => 
    [CodeEDI] => 
    [CodeBarres] => 
    [Photo] => 
    [IdCatalogue1] => 5
    [IdCatalogue2] => 6
    [IdCatalogue3] => 0
    [IdCatalogue4] => 0
    [HorsStatistique] => 
    [VenteAuDebit] => 
    [NonImpression] => 
    [Contremarque] => 
    [FacturationPoids] => 
    [FacturationForfait] => 
    [Transfere] => 
    [Publie] => 1
    [InfosLibres] => Array
        (
            [0] => stdClass Object
                (
                    [Name] => 1ère commercialisation
                    [Type] => 1
                    [Size] => 0
                    [EstCalculee] => 
                    [Value] => 
                )

            [1] => stdClass Object
                (
                    [Name] => Marque commerciale
                    [Type] => 0
                    [Size] => 35
                    [EstCalculee] => 
                    [Value] => 
                )

            [2] => stdClass Object
                (
                    [Name] => Objectif / Qtés vendues
                    [Type] => 3
                    [Size] => 0
                    [EstCalculee] => 
                    [Value] => 
                )

            [3] => stdClass Object
                (
                    [Name] => Pourcentage teneur en or
                    [Type] => 3
                    [Size] => 0
                    [EstCalculee] => 
                    [Value] => 0
                )

        )

)