Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 1.22 KB

01.filter.1.md

File metadata and controls

57 lines (52 loc) · 1.22 KB

Filter (advanced) [accepted]

Shop

{
    "id": 492440,
    "state": "active",
    "verticalId": 2,
    "company": null,
    "address": null,
    "phoneCostsinfo": null,
    "email": "shop492440@localhost",
    "commissionRateDefault": null,
    "commissionRates": [],
    "basicCharge": false,
    "paymentCommissionFee": 4.5,
    "bankData": null,
    "createdAt": "2017-12-10 21:00:12"
}

Request example [accepted]

GET /shops?
filter[paymentCommissionFee][gt]=2&filter[paymentCommissionFee][lt]=7&
filter[createdAt][gte]=2017-01-01 00:00:00&filter[createdAt][lt]=2018-01-01 00:00:00

Client

<?php

$guzzleClient = new \GuzzleHttp\Client();
$guzzleResponse = $guzzleClient->request('GET', 'http://localhost/shops', [
    'query' => [
        'filter' => [
            'paymentCommissionFee' => [
                'gt' => 2,
                'lt' => 7,
            ],
            'createdAt' => [
                'gte' => '2017-01-01 00:00:00',
                'lt' => '2018-01-01 00:00:00',
            ],
        ],
    ],
]);

Query

SELECT * 
FROM shops 
WHERE 
    (paymentCommissionFee > 2 AND paymentCommissionFee < 7) AND
    (createdAt >= '2017-01-01 00:00:00' AND createdAt < '2018-01-01 00:00:00')