forked from Cdiscount/API-MarketPlace-SDK-PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.html
91 lines (73 loc) · 3.12 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<h2>1- Install a web server (for example wamp for windows)</h2>
<h3>1.1 - Min requirements :</h3>
<ul>
<li>Apache 2.2</li>
<li>Php 5.6</li>
</ul>
<h2>2.1- Clone the Git repository in your root project folder and run composer update</h2>
<p>The SDK is structured like that : </p>
<ul>
<li>config/ : config files</li>
<li><a href="samples">samples/</a> : samples folder</li>
<li>sdk/ : content of the Cdiscount SDK (do not modifiy any file of this folder)</li>
</ul>
<h2>2.2- Run the 'composer update' command in the root path of the sdk folder to download Zend Framework dependencies</h2>
<h2>3 - Insert your API's credentials</h2>
<h3>3.1 - Requirements</h3>
<p>To use Cdiscount Marketplace API and Cdiscount Marketplace SDK you first need to follow the steps described in the Cdiscount Marketplace API website.</p>
<p>The sections are the following : </p>
<ul>
<li>Request your account creation.</li>
<li>Have set up your account</li>
</ul>
<h3>3.2 - Update the config files</h3>
<p>Follow the procedure to insert your API credentials</p>
<ul>
<li>Open the config folder</li>
<li>Open the config.ini file</li>
<li>Set the api mode : 'preprod' or 'prod'</li>
<li>Open the preprod.config.ini file or the prod.config.ini file (if you set mode to 'prod')</li>
<li>Set your api username</li>
<li>Set your api password</li>
</ul>
<h2>4 - Use the SDK</h2>
<h3>4.1 - Use the endpoints</h3>
<p>The SDK contains the following endpoints :</p>
<ul>
<li>Seller</li>
<li>Offer</li>
<li>Discussion</li>
<li>Product</li>
<li>Order</li>
<li>Relays</li>
</ul>
<p>All the SDK methods are described in the MarketPlace API Website because they have the same names of the Cdiscount Marketplace API methods.</p>
<p>For each method, you have a PHP file with a sample to call the corresponding API function.</p>
<p>For example, to call the GetSellerInformation API method, open the GetSellerInformation.php file contained in the Seller folder and follow the same steps of the sample.</p>
<h3>4.2 - CDSApiClient Object</h3>
<p>The CDSApiClient allows you to call the API.</p>
<p>The CDSApiClient object contains all the endpoints. It's also create an API call to get a token for you.</p>
<p>Don't create a new CDSApiClient each time you call the API !</p>
<p>You can (have to) use the same CDSApiClient for all your API' calls.</p>
<p>Here an example of how use the same CDSApiClient for many API calls : </p>
<br/>
<code>
$client = new \Sdk\ApiClient\CDSApiClient();
$token = $client->init();
if ($token == null || !$client->isTokenValid()) {
echo "Souci lors de la génération du token";
die;
}
$offerPoint = $client->getOfferPoint();
$offerListResponse = $offerPoint->getOfferList(null);
/** Parse here $offerListResponse **/
$sellerPoint = $client->getSellerPoint();
$sellerResponse = $sellerPoint->getSellerInformation();
/** Parse here $sellerResponse **/
</code>
<h2>5 - Update the SDK</h2>
<p>Download the new SDK Zip file from the CDiscount Marketplace API Website</p>
<p>Erase the SDK folder with the new one</p>
<p>Erase the vendor folder with the new one</p>
<h2>Notes</h2>
<p>In the sample, the parametrer error_reporting is set to '-1'. Do not let it in production mode.</p>