Skip to content

Commit a1cc247

Browse files
committed
Update README for JSON params
1 parent 4c75720 commit a1cc247

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Based on [Etsy Rest API description](http://www.etsy.com/developers/documentation/reference/apimethod) output, this wrapper provides a simple client with all available methods on Etsy API (thanks to the `__call` magic PHP method!), validating its arguments on each request (Take a look to https://github.com/inakiabt/etsy-php/blob/master/src/Etsy/methods.json for full list of methods and its arguments).
44

5-
## I'm looking for help
5+
## I'm looking for help
66
Lately, I couldn't dedicate the time I think this repo deserved, so I'm looking for help!
77

88
## Requirements
@@ -159,6 +159,34 @@ You would be able to fetch associations of given your resources using a simple i
159159
```
160160
To read more about associations: https://www.etsy.com/developers/documentation/getting_started/resources#section_associations
161161

162+
## JSON params ##
163+
There are some methods that Etsy requires to be a JSON string encoded param (ie: param "variations" for "createListingVariations"). For these cases, those params should be defined like this:
164+
```php
165+
$args = array(
166+
'params' => array(
167+
'listing_id' => 654321
168+
),
169+
'data' => array(
170+
'variations' => array(
171+
'json' => json_encode(
172+
array(
173+
array(
174+
'property_id' => 200,
175+
'value' => "Black"
176+
),
177+
array(
178+
'property_id' => 200,
179+
'value' => "White"
180+
)
181+
)
182+
)
183+
)
184+
)
185+
);
186+
187+
$result = $this->api->createListingVariations($args);
188+
```
189+
162190
## Testing ##
163191
```bash
164192
$ vendor/bin/phpunit src/test/

0 commit comments

Comments
 (0)