-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
371 lines (212 loc) · 9.83 KB
/
README
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
NAME
Marketplace::Rakuten - Interface to
http://webservice.rakuten.de/documentation
VERSION
Version 0.04
CATEGORIES
The list of categories for the German marketplace can be downloaded
from the http://api.rakuten.de/categories/csv/download.
When adding or editing a product, you can pass the rakuten_category_id
to add_product or edit_product
SYNOPSIS
use Marketplace::Rakuten;
my $rakuten = Marketplace::Rakuten->new(key => 'xxxxxxx',
endpoint => 'http://webservice.rakuten.de/merchants/'
);
my $res = $rakuten->get_key_info;
ACCESSORS
key
The API key (required).
endpoint
The URL of the endpoint. Default to
http://webservice.rakuten.de/merchants/
If you need a specific api version, it could be something like
http://webservice.rakuten.de/v2.05/merchants
ua
The user-agent. Built lazily.
METHODS
api_call($method, $call, $data);
Generic method to do any call. The first argument is the HTTP request
method (get or post). The second argument is the path of the api, e.g.
(misc/getKeyInfo). The third is the structure to send (an hashref).
Return a Marketplace::Rakuten::Response object.
The key is injected into the data hashref in any case.
API CALLS
Miscellaneous
get_key_info
Product creation
add_product(\%data)
http://webservice.rakuten.de/documentation/method/add_product
Mandatory params: name, price, description
Recommended: product_art_no (the sku)
Return hashref: product_id
add_product_image(\%data)
http://webservice.rakuten.de/documentation/method/add_product_image
Mandatory params: product_art_no (the sku) or product_id (rakuten
id).
Return hashref: image_id
add_product_variant(\%data)
http://webservice.rakuten.de/documentation/method/add_product_variant
Mandatory params: product_art_no (the sku) or product_id, price,
color, label
Return hashref: variant_id
add_product_variant_definition
http://webservice.rakuten.de/documentation/method/add_product_variant
Mandatory params: product_art_no (the sku) or product_id
Recommended: variant_1 Size variant_2 Color
You need to call this method before trying to upload variants. The
data returned are however just a boolean (kind of) success.
add_product_multi_variant
http://webservice.rakuten.de/documentation/method/add_product_multi_variant
Mandatory params: product_art_no (the sku) or product_id,
variation1_type, variation1_value, price
Recommended: variant_art_no
Return hashref: variant_id
add_product_link
http://webservice.rakuten.de/documentation/method/add_product_link
Mandatory params: product_art_no (the sku) or product_id, name (100
chars), url (255 chars)
Return hashref: link_id
add_product_attribute
http://webservice.rakuten.de/documentation/method/add_product_attribute
Mandatory params: product_art_no (the sku) or product_id, title (50
chars), value
Return hashref: attribute_id
Product editing
The following methods require and id passed (sku or id) and work the
same as for product adding, but no argument is mandatory.
They all return just a structure with a boolean success (-1 is failure,
1 is success).
edit_product(\%data)
Requires product_id or product_art_no
edit_product_variant(\%data);
Requires variant_id or variant_art_no
edit_product_variant_definition(\%data)
Requires product_id or product_art_no
edit_product_multi_variant(\%data);
Requires variant_id or variant_art_no
edit_product_attribute
Requires attribute_id, title, value
Product deletion
The following methods require just an id or sku. Return a boolean
success.
delete_product(\%data)
Requires product_id or product_art_no
delete_product_variant(\%data);
Requires variant_id or variant_art_no
delete_product_image(\%data)
Requires image_id (returned by add_product_image).
delete_product_link(\%data);
Requires link_id (returned by add_product_link).
delete_product_attribute
Requires attribute_id (returned by add_product_attribute).
Orders
get_orders(\%params)
No argument is required, but you probably want to pass something like
{ status => pending }
See http://webservice.rakuten.de/documentation/method/get_orders for
the full list of options.
List of statuses:
pending
editable
This is what you want to get for importing.
shipped
payout
Order is paid. Unclear when the status switches to this one.
cancelled
The response is paginated and from here you get only the raw data.
Use get_parsed_orders to get the full list of objects.
get_parsed_orders(\%params)
The hashref with the parameters is the same of get_orders (which get
called). This method takes care of the pagination and return a list
of Marketplace::Rakuten::Order objects. You can access the raw
structures with $object->order.
get_pending_orders
Shortcut for $self->get_parsed_orders({ status => 'pending' });
get_editable_orders
Shortcut for $self->get_parsed_orders({ status => 'editable' });
set_order_shipped(\%params)
Required parameter: order_no (the rakuten's order number).
Accepted parameters:
dhl (boolean, true if Rakuten-DHL-Rahmenvertrag is used)
carrier
tracking_number
tracking_url
set_order_cancelled(\%params)
Required paramater: order_no (rakuten's order number)
Optional: comment
set_order_returned(\%params)
Required paramater: order_no (rakuten's order number) and type (fully
or partly):
http://webservice.rakuten.de/documentation/method/set_order_returned
Category management
add_shop_category(\%params)
Required parameter: name
http://webservice.rakuten.de/documentation/method/add_shop_category
Returned: shop_category_id
edit_shop_category(\%params)
Required parameter shop_category_id or external_shop_category_id
http://webservice.rakuten.de/documentation/method/edit_shop_category
get_shop_categories
No mandatory parameter.
http://webservice.rakuten.de/documentation/method/get_shop_categories
delete_shop_category
Required parameter shop_category_id or external_shop_category_id
http://webservice.rakuten.de/documentation/method/delete_shop_category
add_product_to_shop_category
Required parameters: shop_category_id or external_shop_category_id,
product_id or product_art_no (Rakuten's id or our sku).
http://webservice.rakuten.de/documentation/method/add_product_to_shop_category
AUTHOR
Marco Pessotto, <melmothx at gmail.com>
BUGS
Please report any bugs or feature requests to bug-marketplace-rakuten
at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Marketplace-Rakuten. I
will be notified, and then you'll automatically be notified of progress
on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Marketplace::Rakuten
You can also look for information at:
* RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Marketplace-Rakuten
* AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Marketplace-Rakuten
* CPAN Ratings
http://cpanratings.perl.org/d/Marketplace-Rakuten
* Search CPAN
http://search.cpan.org/dist/Marketplace-Rakuten/
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2015 Marco Pessotto.
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified
Versions is governed by this Artistic License. By using, modifying or
distributing the Package, you accept this license. Do not use, modify,
or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made
by someone other than you, you are nevertheless required to ensure that
your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service
mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge
patent license to make, have made, use, offer to sell, sell, import and
otherwise transfer the Package with respect to any patent claims
licensable by the Copyright Holder that are necessarily infringed by
the Package. If you institute patent litigation (including a
cross-claim or counterclaim) against any party alleging that the
Package constitutes direct or contributory patent infringement, then
this Artistic License to you shall terminate on the date that such
litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.