Reputation: 89
As far as I understood, GET-Requests encode the parameters throught the url. I want to specify data that I get from the shopware REST-API (https://myshopurl/api/orders).
If I append ?limit=1, that works. But now I want to sort the results first. The Shopware Rest API documentation says:
$params = [
'sort' => [
['property' => 'name']
]
];
$client->get('articles', $params);
or
$params = [
'sort' => [
['property' => 'orderTime'],
['property' => 'invoiceAmount', 'direction' => 'DESC']
]
];
$client->get('orders', $params);
but I am not sure how to build the URL from this information, because there are parameters within an array. Where do I have to write down the "sort" and do I have to use some brackets?
I hope somebody can help me :)
Upvotes: 0
Views: 1776
Reputation: 1626
You simply need to put the filter in the url. Here is an example:
http://mydomain/api/orders?filter[0][property]=customer.email&filter[0][value][email protected]
This is the exact example from here: https://developers.shopware.com/developers-guide/rest-api/#filter,-sort,-limit,-offset
Upvotes: 1