ArticleService :: GetCatalogue

The POST method, is used to retrieve data.

The list of necessary parameters for sending a query:

  • int id

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

Input parameters:

{"id":1}

Example:

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

use services\WebServices100;

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

// add parameters
$data = new stdClass();
$data->id = 1;

$json_data = json_encode($data);

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

$response = json_decode($result);

Result:

stdClass Object
(
    [Id] => 1
    [Nom] => Accessoires
    [IdCatalogueParent] => 0
    [SousCatalogues] => Array
        (
            [0] => stdClass Object
                (
                    [Id] => 2
                    [Nom] => Appareils
                    [IdCatalogueParent] => 1
                    [SousCatalogues] => Array
                        (
                        )

                )

            [1] => stdClass Object
                (
                    [Id] => 3
                    [Nom] => Bijoux
                    [IdCatalogueParent] => 1
                    [SousCatalogues] => Array
                        (
                        )

                )

            [2] => stdClass Object
                (
                    [Id] => 4
                    [Nom] => Montres
                    [IdCatalogueParent] => 1
                    [SousCatalogues] => Array
                        (
                        )

                )

        )

)