putting an api into my shopify

Allison_Judd
Shopify Partner
4 0 0

I will be dropshipping personalised clothing and the company have given me an api script and an api key to import into my shop.

 

How and where do i do this?

0 Likes
Jason
Shopify Expert
10037 119 1872

Here is the likely starting point:
http://docs.shopify.com/api

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Allison_Judd
Shopify Partner
4 0 0

Thats great Jason, I have read it and it wants me to create the app itself through the development tools.

 

However the app is already built and i have my api key already provided for me, i just need to import into my shop. This app is for my use only and is not for use within the shopify app store for other people to use.

The in structions in the api document ends when you have you app and key :/ so im a little confused.

 

0 Likes
PJ_Celis
Shopify Partner
74 0 9

Can you be more specific which API you are talking about and what you want to do with it?

Is it an API key from the dropshipping vendor to import product data into your shop? 

0 Likes
Allison_Judd
Shopify Partner
4 0 0

its for my customers order to go straight with all required information to my dropshipper. I will be supplying people with personalised sweatshoits etc

 

I have been provided with the key and coding either in json or xml. I have been told by shopify that it needs to be json but thats all the information i can get.

<?php
/*
API Post Order Test Script
Clothes2order.com
*/

//Defines
define('API_KEY','your-api-key');
define('API_URL','https://www.clothes2order.com/api/post-order/';);

//Set your data here
$post_data = '
<xml>
 <api_key>' . API_KEY . '</api_key>
 <order>
  <order_id>123456</order_id>
  <order_notes><![CDATA[Any extra information here]]></order_notes>
  <delivery_method>standard</delivery_method>
 </order>
 <customer>
  <name>Name Here</name>
  <email>email@email.com</email>
  <telephone>0161123456</telephone>
 </customer>
 <address>
  <delivery_name>Name</delivery_name>
  <company_name>Quayside Clothing Ltd</company_name>
  <address_line_1>Unit 9 Wheel Forge Way</address_line_1>
  <address_line_2>Trafford Park</address_line_2>
  <city>Manchester</city>
  <postcode>M17 1EH</postcode>
  <country>United Kingdom</country>
 </address>
 <products>
  <product>
   <sku>594-117-15</sku>
   <quantity>2</quantity>
   <logos>
    <logo>
     <unique_id>TEST_02</unique_id>
     <file><![CDATA[http://www.clothes2order.com/images/c2o_new_2013/layout/carousel/15.jpg]]></file>;
     <position>3</position>
     <width>8</width>
     <type>print</type>
    </logo>
    <logo>
     <unique_id>TEST_03</unique_id>
     <file><![CDATA[http://www.clothes2order.com/images/c2o_new_2013/layout/carousel/14.jpg]]></file>;
     <position>5</position>
     <width>12</width>
     <type>print</type>
    </logo>
   </logos>
  </product>
    <product>
   <sku>1316-1-13</sku>
   <quantity>1</quantity>
   <logos>
    <logo>
     <unique_id>TEST_04</unique_id>
     <file><![CDATA[http://www.clothes2order.com/images/c2o_new_2013/layout/carousel/32.jpg]]></file>;
     <position>5</position>
     <width>10</width>
     <type>embroidery</type>
    </logo>
    <logo>
     <unique_id></unique_id>
     <file><![CDATA[http://www.clothes2order.com/images/c2o_new_2013/layout/carousel/16.jpg]]></file>;
     <position>9</position>
     <width>25</width>
     <type>print_1colour</type>
    </logo>
   </logos>
  </product>
 </products>
</xml>
';

//Post data to the API
$ch = curl_init(API_URL);
curl_setopt($ch, CURLOPT_HTTPHEADER,
 array('Content-Type: application/xml',
       'Accept: application/xml'
       )
);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$ch_result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

//Get response
$obj = simplexml_load_string($ch_result);

//Check HTTP status
if ($http_code == 200) {
 //All OK
 echo 'All seems OK: ' . $obj->status->msg  . "<br />\n";

 //Lets echo some values
 echo 'Clothes2order order ID: ' . $obj->order_details->order_id . "<br />\n";
 echo 'This order has cost you: &pound;' . $obj->order_details->net_order_value . "<br />\n";
 echo 'Estimated dispatch date: ' . $obj->order_details->est_dispatch_date . "<br />\n";

 if (sizeof($obj->warnings->warning) > 0) {
  foreach ((array)$obj->warnings->warning as $warning) {
   echo 'Warning: ' . $warning . "<br />\n";
  }
 }

 if (sizeof($obj->test_msgs->msg) > 0) {
  foreach ((array)$obj->test_msgs->msg as $test_msg) {
   echo 'Test message: ' . $test_msg . "<br />\n";
  }
 }
} elseif ($http_code == 400) {
 //There was an error
 echo 'Error occured: ' . $obj->status->msg  . "<br />\n";
}

exit;
?>

0 Likes
PJ_Celis
Shopify Partner
74 0 9

Hi Allison,

Sorry for the late reply, I forgot about this thread.

Looks like you need a private app that subscribes to the order webhook and submits certain order data to the API from Clothes2Order.

How many orders per month are you doing roughly? If only a few, I'd say submit orders manually for now (if Clothes2Order allows this). If enough to invest a little in automating this task, I'd be happy to do a quick call with you this week and see if we can work something out.

But again, I'd only recommend automating this if you have high enough order volume.

0 Likes
Allison_Judd
Shopify Partner
4 0 0

Thanks PJ.

i have had to make a complaint to clothes2order with regards to this as I was told by a member of staff, that all their documentation is conclusive and obvioulsy if I dont understand it then i should basically either forget about it or hire someone to sort it for me.

Lovely customer service! I have the managing director of the company now investigating it.

 

I have told him that I want me website to go live within a day and I will be manually ordering anything my customers order from me.

Why would you recommend automating only on high call volumes? At this moment in time, I have no idea what I would be generating.

0 Likes
PJ_Celis
Shopify Partner
74 0 9

I recommend only automating with high enough sales volume cause having someone make a private app, even a rather simple one as you need, will cost some money. You need to compare that cost with the money you save.

Say it will cost you $500 to have this integration done by a Shopify expert. If placing an order manually costs you 3 minutes and you can hire staff at $20 all-in hourly cost to do so, then (even if you place the order yourself) you can say the private app would save you $1 each time an order comes in.

So with 100 orders a month a $500 investment returns 20% per month. Great. With 10 orders per month, only 2% per month, which may sound high compared to the stock market but as you will have to write off the entire $500 if your startup business fails, it's not the best investment. In the software world we would call this pre-mature optimization.

Also note that even if you suddenly have a huge spike in orders, a developer can download all the non-fulfilled orders via the Shopify API and then submit them to the Clothes2Order API. So don't think you need this private app before the orders come in. So really no need to worry, do things manually and when overwhelmed due to too many sales for manual entry contact me or any other developer on this forum to help you out. When this happens, the profits on those sales will pay for the private app development easily and your return on time / money saved will make it an obvious investment.

Good luck with your business!

0 Likes
ravibains
Tourist
7 0 0

Hi Pj, 

i am after something like this and i am pretty stuck in getting the products of our suppliers loaded to our website.

Can you assist in any way?

 

Thanks

0 Likes