You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Supported API segments](#supported-api-segments)
57
61
*[Marketplace](#marketplace)
@@ -113,13 +117,14 @@ The `Configuration` class is used to configure the client library. It takes thre
113
117
-`$clientId`: Your Walmart Client ID
114
118
-`$clientSecret`: Your Walmart Client Secret
115
119
-`$options`: An optional associative array of additional configuration parameters. Valid options are:
116
-
-`consumerId`: Your Walmart Consumer ID. Required if you are a Marketplace Seller selling in Canada, a Drop Ship Vendor, a Content Provider, or a Warehouse Supplier.
117
-
-`privateKey`: Your Walmart private key. Required if you are a Marketplace Seller selling in Canada, a Drop Ship Vendor, a Content Provider, or a Warehouse Supplier.
118
120
-`country`: The country you are selling in. One of `Country::US`, `Country::CA`, or `Country::MX`. Defaults to `US`.
119
-
-`accessToken`: An instance of `Walmart\AccessToken`, containing an access token and its expiration time. If provided, this will be used instead of the client ID and secret to authenticate API calls, until the token expires. This is useful if you want to reuse an access token that you've already retrieved from Walmart.
121
+
-`consumerId`: Your Walmart Consumer ID. Required if you are making requests to endpoints that use signature-based auth (see the [Authorization](#authorization) section)
122
+
-`privateKey`: Your Walmart private key. Ditto the requirements for the `consumerId` option.
123
+
-`accessToken`: An instance of `Walmart\AccessToken`, containing an access token and its expiration time. If provided, this will be used instead of the client ID and secret to authenticate API calls, until the token expires. This is useful if you want to reuse an access token that you've already retrieved from Walmart. More details on access token auth [below](#access-token-auth).
120
124
121
125
If you try to instantiate an instance of an API class that is not supported in the country you've specified, an exception will be thrown.
122
126
127
+
123
128
### Using API classes
124
129
125
130
The API classes are divided into four categories: Marketplace, Drop Ship Vendor, Content Provider, and Warehouse Supplier. Each category has its own namespace, and each country has its own sub-namespace. For example, the Marketplace APIs for the US are located in the `Walmart\Apis\MP\US` namespace, and the Drop Ship Vendor APIs for Canada are located in the `Walmart\Apis\DSV\CA` namespace.
@@ -172,6 +177,20 @@ API methods often take model classes as parameters, and return them as API respo
172
177
In order to represent the various data structures that the APIs ingest and return, this library uses model classes. Each model class represents a single data structure, and has a constructor that takes an associative array of data. The model class documentation is divided by API category, country, and API class. Documentation for each model class is nested inside the `docs/Models` folder corresponding to the model class's location in the `src/Models` folder. For instance, the response model for the Marketplace Authorization API's `getTokenDetail` method in the US is [`Walmart\Models\MP\US\Authorization\TokenDetailResponse`](https://github.com/highsidelabs/walmart-api-php/blob/main/src/Models/MP/US/Authentication/TokenDetailResponse.php), and the docs are at [`docs/Models/MP/US/Authorization/TokenDetailResponse.md`](https://github.com/highsidelabs/walmart-api-php/blob/main/docs/Models/MP/US/Authentication/TokenDetailResponse.md).
173
178
174
179
180
+
### Authorization
181
+
182
+
Walmart uses three different forms of authentication for its APIs: basic auth, access tokens, and request signatures. This library handles all three automatically, so you shouldn't have to think about them much...but if you're curious about how it works, read on.
183
+
184
+
#### Basic auth
185
+
This the standard, simplest form of authentication. It uses the Walmart client ID and client secret that are passed to the `Configuration` constructor in order to generate an authorization header value. It's also used to generate an access token if necessary, which is why these are the two required parameters for the `Configuration` constructor.
186
+
187
+
#### Access token auth
188
+
For a lot of the Marketplace API, Walmart uses access token authentication. The access token is a short-lived token (15min) that is generated by Walmart with the client ID and client secret, and then used to authenticate API calls. This library automatically handles the generation and renewal of access tokens, so you don't have to worry about it. If you want to reuse an access token that you've already retrieved from Walmart, you can pass it to the `Configuration` constructor via the `accessToken` option.
189
+
190
+
#### Request signature auth
191
+
For most of the rest of the APIs aside from the Marketplace API, Walmart uses request signature auth. This is just another value that is passed as a header, and it is generated using the request method and path, a timestamp, and your consumer ID and private key. If you're making requests that involve signature auth, you need to pass the `privateKey` and `consumerId` options to the `Configuration` constructor's options array.
192
+
193
+
175
194
### Debug mode
176
195
177
196
To get debugging output when you make an API request, you can call `$config->setDebug()`. By default, debug output goes to `stdout` via `php://output`, but you can redirect it a file with `$config->setDebugFile('log/file/path.log')`.
This endpoint requires the following authorization methods:
65
+
66
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
67
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
68
+
69
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
70
+
73
71
74
72
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
75
73
[[Back to Model list]](../../../Models/CP/US)
@@ -93,11 +91,6 @@ use Walmart\Walmart;
93
91
94
92
require_once __DIR__ . '/vendor/autoload.php';
95
93
96
-
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
97
-
'country' => 'US', // Default US if not set
98
-
'privateKey' => 'PRIVATE_KEY',
99
-
'consumerId' => 'CONSUMER_ID',
100
-
]);
101
94
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
This endpoint requires the following authorization methods:
131
+
132
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
133
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
134
+
135
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
136
+
141
137
142
138
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
143
139
[[Back to Model list]](../../../Models/CP/US)
@@ -161,11 +157,6 @@ use Walmart\Walmart;
161
157
162
158
require_once __DIR__ . '/vendor/autoload.php';
163
159
164
-
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
165
-
'country' => 'US', // Default US if not set
166
-
'privateKey' => 'PRIVATE_KEY',
167
-
'consumerId' => 'CONSUMER_ID',
168
-
]);
169
160
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
This endpoint requires the following authorization methods:
199
+
200
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
201
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
202
+
203
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
204
+
211
205
212
206
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
213
207
[[Back to Model list]](../../../Models/CP/US)
@@ -231,11 +225,6 @@ use Walmart\Walmart;
231
225
232
226
require_once __DIR__ . '/vendor/autoload.php';
233
227
234
-
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
235
-
'country' => 'US', // Default US if not set
236
-
'privateKey' => 'PRIVATE_KEY',
237
-
'consumerId' => 'CONSUMER_ID',
238
-
]);
239
228
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
This endpoint requires the following authorization methods:
486
+
487
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
488
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
489
+
490
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
491
+
500
492
501
493
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
This endpoint requires the following authorization methods:
62
+
63
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
64
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
65
+
66
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
67
+
70
68
71
69
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
This endpoint requires the following authorization methods:
65
+
66
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
67
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
68
+
69
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
70
+
73
71
74
72
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
75
73
[[Back to Model list]](../../../Models/DSV/US)
@@ -93,11 +91,6 @@ use Walmart\Walmart;
93
91
94
92
require_once __DIR__ . '/vendor/autoload.php';
95
93
96
-
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
97
-
'country' => 'US', // Default US if not set
98
-
'privateKey' => 'PRIVATE_KEY',
99
-
'consumerId' => 'CONSUMER_ID',
100
-
]);
101
94
$config = new Walmart\Configuration('CLIENT_ID', 'CLIENT_SECRET', [
This endpoint requires the following authorization methods:
133
+
134
+
*`signatureScheme`: Request signature authentication. Request signatures are generated using a combination of request info, a timestamp, and your Walmart consumer ID and private key. The signature is passed in the WM_SEC.AUTH_SIGNATURE header. This is always used in tandem with consumer ID authentication (above). When using endpoints that require signature authentication, you must pass the `privateKey` and `consumerId` options to the `Configuration` constructor.
135
+
*`consumerIdScheme`: Header authentication with your Walmart consumer ID, which is passed in the WM_CONSUMER.ID header. This is always used in tandem with signature authentication (below). When using endpoints that require consumer ID authentication, you must pass the `consumerId` option to the `Configuration` constructor.
136
+
137
+
See the [Authorization](../../../../README.md#authorization) section of the README for more information.
138
+
143
139
144
140
[[Back to top]](#)[[Back to API list]](../../../../README.md#supported-apis)
0 commit comments