Top
Developers Your place to code all things handmade

Welcome to the Shopclues Developer Platform

We believe in code as craft. Join the community of developers, creators and build tools that enrich the ways you can shop, sell and connect with the India's largest merchant base most easily.

Get Started

Register, Upload, Search and Connect

Explore Shopclues' marketplace of over 8.5 million products from over 3.5 lakh merchants. Connect buyers with the items they'll love.

Learn More About Catalog Management

Login, Integrate and Create

Build the best tools for Shopclues merchants. Simply login, Integrate and start developing you own apps.

Learn More About Start Developing
<
>
Jump to: navigation, search

Making Requests

How to Make A Request And Process The Response

Here's a step-by-step example of how to make a request to the Shopclues API. This example uses the public endpoint, so no OAuth authentication is required. For an example using OAuth, see the next section.

We'll make a request to get details for the user that runs the official "Shopclues Marketplace" using the getUser method. You can also substitute your own user name for Shopclues Marketplace. If you consult the documentation for that method, you'll see the following:

HTTP Method GET
recourse Name order
URI order/order_id
Parameters Name                                                  Required                                                               Type
user_id                                                 Yes                                                 array(user_id_or_name)

Every Shopclues API request begins with the base URL:


|http://developer.shopclues.com/api/v1/ |}

And ends with the URI for the command. The part of the URI that reads :order_id is an embedded parameter—you'll need to substitute either the order data "shopclues" or the order id of the order you're trying to access.

Finally, you'll add a question mark (?) plus any optional parameters you'd like to send, and of course, your API key. The final request looks like this:

http://sandbox.shopclues.com/oauth/authorize/index.php?token=0e196ab3480168faaf8b13cb9b390b74b704dfd7&client_id=testclient1&key=1439813599

You can test this right in your browser. You should see a long string of JSON data language. Note that the object returned is of resource type User. See User in the API Reference for more details.

Sample Request from PHP

Here is an example of a call in a PHP script. You can use php and java language that supports HTTP requests (java, php) which is just about java, php language in use on the web.


Make sure you define API_KEY to be your unique, registered key
$headers = array(
 'Authorization:Bearer '''your access token''' ',
 'Content-Type: application/json',);
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, "http://developer.shopclues.com/v1/api/order");
 curl_setopt($ch, CURLOPT_GET, 1);
 curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
 $result = curl_exec($ch);
 curl_close($ch);

Notice that we're using the value of $result as an error message. In the event of an error, the result body will contain a plaintext formatted explanation of the problem. The error will not be JSON encoded.

Sample Response

Here's the response from our request above (with added white space to make it easier to read.) The response is formatted using JSON, a simple data.

{
  "status": 1,
  "code": 200,
  "message": "success",
  "data": [
    {
      "order_id": "76996265",
      "user_id": "11028919",
      "is_parent_order": "N",
      "exempt_from_billing": "0",
      "parent_order_id": "0",
      "company_id": "1",
      "timestamp": "1448879008",
      "firstname": "Lokesh",
      "lastname": "Singh",
      "email": "lokesh.mnit@gmail.com",
      "status": "E",
      "total": "34.00",
      "subtotal": "10.00",
      "details": "Delivery Region: Delhi NCR \n",
      "net_payout": null,
      "payment_id": "6",
      "s_city": "Gurgaon",
      "s_state": "HR",
      "s_zipcode": "122001",
      "label_printed": "n",
      "gift_it": "N",
      "items_list": [
        {
          "product": "Product-Test-Crestech-4",
          "product_id": "78363196",
          "amount": "1",
          "selling_price": "10.00",
          "image_path": "cdn.shopclues.com/images/thumbnails/18875/160/160/imagetest1433145582.jpg"
        }
      ]
    }
  ]
}

Looking for ShopClues Apps?

Check out our new
App Gallery!

It's the best way to find cool and useful tools built upon Shopclues's API.