How to pull products through API

make a CURL request to get the products: https://yourdomain/index.php?route=api/product. Following is the code:


<?php
$url = "yourdomain";
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => $url . "/index.php?route=api%2Fproduct",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}


Also, you can send the filter data array. For example:

$data = array(
            'filter_category_id'  => '63',
            'sort'  => 'p.date_added',
            'order' => 'DESC',
            'start' => 0,
            'limit' => $setting['limit']
        );


The response you get will be like below


{
    "products": [{
        "product_id": "30",
        "thumb": "https:\/\/demo.store\/image\/cache\/catalog\/demo\/canon_eos_5d_1-228x228.jpg",
        "name": "Canon EOS 5D",
        "description": "Canon's press material for the EOS 5D states that it 'defines (a) new D-SLR category', while we're n..",
        "price": "$122.00",
        "special": "$98.00",
        "tax": "$80.00",
        "minimum": "1",
        "rating": 0,
        "href": "https:\/\/demo.store\/index.php?route=product\/product&product_id=30"
    }, {
        "product_id": "47",
        "thumb": "https:\/\/demo.store\/image\/cache\/catalog\/demo\/hp_1-228x228.jpg",
        "name": "HP LP3065",
        "description": "Stop your co-workers in their tracks with the stunning new 30-inch diagonal HP LP3065 Flat Panel Mon..",
        "price": "$122.00",
        "special": false,
        "tax": "$100.00",
        "minimum": "1",
        "rating": 0,
        "href": "https:\/\/demo.store\/index.php?route=product\/product&product_id=47"
    }]
}