FROM CACHE - en_header

API For Access my Store Database .

Jagathambal_Kar
Tourist
16 0 3

I just Got know that i can access my Store database Through "API", i want to know more about this API .

How it will works ?

Is it free ? ( if not....! then what is the  price structure and limitaion ).

i have not found any answer for this . even i have consulted Support. they have clearly refused to give information regarding this .

thanks in advance

Manikanta

 

Replies 8 (8)
Jason
Shopify Expert
10898 191 2185

The documentation on the API is public, and available here:
https://help.shopify.com/api

There's no cost to use the API, though you'll need Shopify account (obviously) and some features may be restrictured (like Plus API endpoints). It's all noted in the docs.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Jagathambal_Kar
Tourist
16 0 3

Ya.  thank you .

Can i import my data to shopify database using API . ? instead of importing in CSV format.

Jason
Shopify Expert
10898 191 2185

Sure can!

If you're talking about adding products you'll want to focus on the products endpoint. There's an example of how to create a product here:

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Jagathambal_Kar
Tourist
16 0 3

Thnaks again Jason ..

i have called my API for 3 time so product has inserted 3 time too with same SKU number .

http://screencast.com/t/rpdu6O9af

any idea how to avoid this ?

GL
Shopify Partner
6 0 0

You need to provide more details for the results, for example the script you used.

API is just another interface to interact with your webstore. You can basicly do the same thing as you can do on the admin portal after auth granted. Have a look a the api documentation as Jason provided above, you will find all the endpoint for it.

If you have other web stores and planning to migrate or sync your data on the shopify web stroe, use some scripts or build a connector app via api can be a good option instead of spreadsheet. It depends on what you are trying to do.

Jagathambal_Kar
Tourist
16 0 3

I hope the "SKU" is the primary key in shopify , and i think it will not allow you Duplicate SKU numbers .

here is my code

<?php

$vendor = "kanta";
$products_array = array(
    "product"=>array(
        'title'=>'',
        "title"=> "Burton Custom Freestlye 151",
        "body_html"=> "<strong>Good snowboard!</strong>",
        "vendor"=> $vendor,
        "product_type"=> "Snowboard",
        "published"=> true ,
        "variants"=>array(
                        array(
                              "id"=> null,
                              "product_id"=> 327475578523353102,
                              "title"=> "",
                              "price"=> "19.99",
                              "sku"=> "Ac-mani-Gowda1",
                              "image"=> "http://cdn.shopify.com/s/files/1/0040/7092/products/red-rain-coat.jpeg?v=1402604893",
                              "position"=> 0,
                              "grams"=> 200, 

                        )
        )


       
    )
);
echo json_encode($products_array);
echo "<br />";
$url = "https://XXX:YYY :x.com/admin/products.json";

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($products_array));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec ($curl);
curl_close ($curl);
echo "<pre>";
print_r($response); 

?>


After calling this API the data is storing multiple time with same SKU number .

 

thank you

mani

 

 

Jason
Shopify Expert
10898 191 2185

SKU is not a unique field so can be a duplicate, or even blank.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Rakesh_Singh
New Member
3 0 0

Please provide the name of api