1

Please let me know how I can get the all products through the Flipkart seller API. I am not able to get this api.

I have tried this but it gives me error:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.flipkart.net/sellers/listings/v3');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$headers = array();
$headers[] = 'Authorization: Bearer xxxxxx-8be7-429c-xxx-xxxx';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}else{
    echo $result;
}
curl_close($ch);

output: {"errors":[{"severity":"ERROR","code":10000,"description":"HTTP 405 Method Not Allowed"}]}

Please help me to get all products.

Thanks in Advance!!

1 Answers1

0

You should read the doc. The error is pretty clear, you're using GET instead of POST for this url endpoint.

Following the doc you can see this section:

Retrieve the information listed against the provided SKU Ids.

https://seller.flipkart.com/api-docs/listing-api-docs/LMAPIRef.html#get-listings-v3-sku-ids

I guess that it's what you want.

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.flipkart.net/sellers/listings/v3/my-sku-id",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer XXXXXX"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

And please, do not share your token in a public post.

Baptiste
  • 1,688
  • 1
  • 15
  • 25
  • Hello @Baptiste Thanks for your response. I have already checked this API but in this case, we need to manually put the sku-ids and it gives me information on specific products that we put in SKUs. I need to get all active listing products from flipkart seller account. Please let me know if you can help. – Kindlebit Php Jul 19 '22 at 12:44
  • The API doesn't seem to allow that – Baptiste Jul 19 '22 at 12:48
  • @KindlebitPhp, Please let me know if you have find solution to this problem, we are facing the same issue also. – Dhruv Vadodariya Dec 30 '22 at 08:57
  • is there any development still going on in these apis? – Laxman Marothiya Feb 23 '23 at 09:06