Permalink
Browse files

added endpoint models

  • Loading branch information...
1 parent 527933e commit 780fe2d627c67b062d67fb05d9b9d7038830b546 @Ventata committed Aug 2, 2012
View
@@ -25,12 +25,13 @@ Example Code
Endpoints
-------------
-* [Stores](https://github.com/ventata/api/endpoints/stores.md)
-* [Products](https://github.com/ventata/api/endpoints/products.md)
-* [Orders](https://github.com/ventata/api/endpoints/orders.md)
-* [Company](https://github.com/ventata/api/endpoints/company.md)
-* [Users](https://github.com/ventata/api/endpoints/users.md)
-* [Billing](https://github.com/ventata/api/endpoints/billing.md)
+
+* [Stores](https://github.com/Ventata/API/blob/master/endpoints/stores.md)
+* [Products](https://github.com/Ventata/API/blob/master/endpoints/products.md)
+* [Orders](https://github.com/Ventata/API/blob/master/endpoints/orders.md)
+* [Company](https://github.com/Ventata/API/blob/master/endpoints/company.md)
+* [Users](https://github.com/Ventata/API/blob/master/endpoints/users.md)
+* [Billing](https://github.com/Ventata/API/blob/master/endpoints/billing.md)
Authentication
@@ -39,12 +40,15 @@ Authentication
Auth is done through an API Key on the end of the querystring. When you first sign up, we'll send you a company API key. With this key, you'll be able to create as many stores as you want. Each store will get it's own unique api key returned in the response.
**When do I use the Company API Key?**
+
When you are using Company, Stores, Users or Billing endpoints.
**When do I use the Store API Key?**
+
When you are using Products or Orders endpoints.
**Why is it setup this way?**
+
You can have many stores to a single company and we can control how much access a store API Key has, if you just had a single point of authenticating then all stores would be able to access all the other stores' data. With the multiple API key system, if you want contractors to integrate our API into one of your sites, you can give them the relavent Store API Key for it without having to give them access to all of your other stores.
View
@@ -0,0 +1,31 @@
+/billing/creditcard
+<pre>
+{
+ "CardType": "AMEX",
+ "CardholderName": "John Doe",
+ "CompanyId": "5df8c91b-a140-4317-b623-46gh0e2898f3",
+ "DateCreated": "/Date(1339569371823-0700)/",
+ "ExpMonth": "01",
+ "ExpYear": "2016",
+ "Id": "3705124e-0l53-48de-9e12-a8a3a5465ab0",
+ "LastFourCC": "0005",
+ "PrimaryAccountNumber": "378282246310005"
+}
+</pre>
+
+/billing/address
+<pre>
+{
+ "Address1": "1000 Main Street",
+ "Address2": "",
+ "City": "Fresno",
+ "CompanyId": "5df8b21b-a140-4317-b753-454d0e2898f3",
+ "DateCreated": "/Date(1336921560600-0700)/",
+ "DateModified": "/Date(1336921560600-0700)/",
+ "Id": "e3422609-d95f-4e25-a71d-e4e3bf96e38c",
+ "Name": "Mike Dawson",
+ "Phone": 5555555555,
+ "State": "CA",
+ "Zip": "93703"
+}
+</pre>
View
@@ -0,0 +1,15 @@
+<pre>
+{
+ "Address1": "1000 Main Street",
+ "Address2": "",
+ "City": "Los Angeles",
+ "DateCreated": "/Date(1329264000000+0000)/",
+ "DateModified": "/Date(1422835200000+0000)/",
+ "FaxNumber": 5553002000,
+ "Id": "5df8b21b-a140-4317-b753-454d0e2898f3",
+ "Name": "Test Company",
+ "PhoneNumber": 5552003000,
+ "State": "CA",
+ "Zip": "90067"
+}
+</pre>
View
@@ -0,0 +1,55 @@
+<pre>
+{
+ "DateCreated": "/Date(1339205240+0000)/",
+ "ExternalOrderId": "1260",
+ "Id": "0c1f8d21-e9d9-417a-9e0f-009578b8d439",
+ "OrderDetails": [
+ {
+ "CostPerItem": 4.96,
+ "Id": "f6cf2460-0f19-47bb-afea-38e1d66bf3b7",
+ "ManuCode": "",
+ "OrderId": "0c1f8d21-e9d9-417a-9e0f-009578b8d439",
+ "PricePaid": 4.96,
+ "ProductId": "00000000-0000-0000-0000-000000000000",
+ "Quantity": 1,
+ "StoreCode": "824"
+ },
+ {
+ "CostPerItem": 14.99,
+ "Id": "cf471737-a71c-4bff-8182-452ae663a46a",
+ "ManuCode": "",
+ "OrderId": "0c1f8d21-e9d9-417a-9e0f-009578b8d439",
+ "PricePaid": 14.99,
+ "ProductId": "00000000-0000-0000-0000-000000000000",
+ "Quantity": 1,
+ "StoreCode": "739"
+ },
+ {
+ "CostPerItem": 0,
+ "Id": "25c98641-3509-471f-88aa-725ed10c8a71",
+ "ManuCode": "",
+ "OrderId": "0c1f8d21-e9d9-417a-9e0f-009578b8d439",
+ "PricePaid": 0,
+ "ProductId": "00000000-0000-0000-0000-000000000000",
+ "Quantity": 1,
+ "StoreCode": "722"
+ },
+ {
+ "CostPerItem": 9.98,
+ "Id": "0a3a75ef-7983-4561-a99d-85179bf1aa6e",
+ "ManuCode": "",
+ "OrderId": "0c1f8d21-e9d9-417a-9e0f-009578b8d439",
+ "PricePaid": 9.98,
+ "ProductId": "00000000-0000-0000-0000-000000000000",
+ "Quantity": 1,
+ "StoreCode": "726"
+ }
+ ],
+ "ShippingCost": 0,
+ "ShopperId": "00000000-0000-0000-0000-000000000000",
+ "StoreId": "141f55de-7776-49e2-996e-7c0cfc6c5f92",
+ "SubTotal": 29.93,
+ "Taxes": 0,
+ "TotalPrice": 29.93
+}
+</pre>
View
@@ -0,0 +1,29 @@
+<pre>
+{
+ "CapacityBaselinePrice": 0,
+ "CapacityCurb": 0,
+ "Cost": 4.5,
+ "CurrentMode": 0,
+ "CurrentSupply": 0,
+ "DateAvailable": "/Date(-62135596800000+0000)/",
+ "DateCreated": "/Date(1343876420697+0000)/",
+ "DateExpires": "/Date(-62135596800000+0000)/",
+ "Description": "The most amazing Nirvana t-shirt anyone will ever own",
+ "ExpectedSale": "/Date(-62135596800000+0000)/",
+ "ExploitUntil": "/Date(-62135596800000+0000)/",
+ "Id": "6ade437a-8535-4d84-979c-08a69d3d9228",
+ "LastEvaluation": "/Date(1343876420697+0000)/",
+ "MANUCODE": "TSHIRT120",
+ "MaxPrice": 0,
+ "MinPrice": 0,
+ "Name": "New testing",
+ "Price": 10,
+ "PriceGroup": 0,
+ "ProfitRate": 0,
+ "SKU": "SHIRT-1",
+ "StartingSupply": 0,
+ "StoreCode": null,
+ "StoreId": "141f55de-7776-49e2-996e-7c0cfc6c5f92",
+ "Strategy": "Unlimited Supply"
+}
+</pre>
View
@@ -0,0 +1,12 @@
+<pre>
+{
+ "ApiKey": "14sbf780-77fa-46fd-be2c-41141af6d58c",
+ "CompanyId": "5df8b21b-a140-4317-b753-455g0e2898f3",
+ "DateCreated": "/Date(1329782400000+0000)/",
+ "DateModified": "/Date(1329782400000+0000)/",
+ "Id": "141f55de-7776-49e2-996e-7c0cf7kc5f92",
+ "Name": "My Awesome TShirt Store",
+ "StoreType": null,
+ "URL": "https://myTShirtStoreOnline.com"
+}
+</pre>
View
@@ -0,0 +1,23 @@
+Internal Users
+=========
+
+<pre>
+{
+ "Address1": "1000 Main Street",
+ "Address2": "",
+ "City": "Los Angeles",
+ "CompanyId": "5df8b21b-a140-4317-b753-454d0e2898f3",
+ "DateCreated": "/Date(1330070400000-0800)/",
+ "DateModified": "/Date(1336921587027-0700)/",
+ "EmailAddress": "JohnDoe@myTShirtStoreOnline.com",
+ "FaxNumber": 5555554444,
+ "FirstName": "John",
+ "Id": "e6c6144d-7376-4e9c-978a-7d47814b2896",
+ "LastName": "Doe",
+ "MobileNumber": 5554445555,
+ "Password": null,
+ "PhoneNumber": 5553335555,
+ "State": "CA",
+ "Zip": "90067"
+}
+</pre>
View
@@ -4,8 +4,9 @@ PHP Wrapper for Ventata API
cURL Library
-----------
-* `suda apt-get install curl-ssl` to install curl for PHP
+* `sudo apt-get install curl-ssl` to install curl for PHP
**For more information:**
-*http://curl.haxx.se/
-*http://php.net/manual/en/book.curl.php
+
+* http://curl.haxx.se/
+* http://php.net/manual/en/book.curl.php
@@ -5,6 +5,8 @@ function send_order_to_ventata($order)
//enter your store API key here
$storeApiKey = '';
+
+ //build out the order in the data array
$data = array();
$data['DateCreated'] = "/Date(" . date('U', strtotime($order['date_purchased'])) . '+0000)/';
$data['ExternalOrderId'] = $order['order_id'];
@@ -13,7 +15,7 @@ function send_order_to_ventata($order)
$data['Taxes'] = $order['taxes'];
$data['TotalPrice'] = $order['total_price'];
- //populate the order details array
+ //build out the order details in the data['OrderDetails'] array
$data['OrderDetails'] = array();
foreach ($order['Order_Details'] as $orderDetail)
{
@@ -27,12 +29,14 @@ function send_order_to_ventata($order)
array_push($data['OrderDetails'], $tempData);
}
+
+
+ //encode the array in json...
$data_string = json_encode($data);
- $ch = curl_init();
-
+ //and send it via curl
+ $ch = curl_init();
$url = "https://api.ventata.com/order?ApiKey=" . $storeApiKey;
-
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
@@ -5,6 +5,7 @@ function send_product_to_ventata($product)
//enter your ventata store API key here
$storeApiKey = '';
+ //build out the product in the data array
$data = array(
'Cost' => 0,
'DateCreated' => '/Date(' . date('U', strtotime($product['products_date_added'])) . '+0000)/',
@@ -17,10 +18,12 @@ function send_product_to_ventata($product)
'Strategy' => 'Unlimited Supply',
);
+ //encode the array in json...
$data_string = json_encode($data);
+
+ //and send it via curl
$ch = curl_init();
- $url = "https://api.ventata.com/product?ApiKey=" . $apiKey;
-
+ $url = "https://api.ventata.com/product?ApiKey=" . $apiKey;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
@@ -5,15 +5,18 @@ function send_store_to_ventata($store)
//enter your ventata company API key here
$companyApiKey = '';
+ //build the store information in an array
$data = array(
'Name' => 'My Awesome TShirt Store',
'URL' => 'https://myTShirtStoreOnline.com',
);
+ //encode the array in json...
$data_string = json_encode($data);
+
+ //and send it via curl
$ch = curl_init();
- $url = "https://api.ventata.com/store?ApiKey=" . $apiKey;
-
+ $url = "https://api.ventata.com/store?ApiKey=" . $apiKey;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
View
@@ -7,7 +7,8 @@ Requests Library
* `pip install requests` to install Requests library
**For more information:**
-*http://python-requests.org
+
+* http://python-requests.org
-*http://docs.python-requests.org/en/latest/user/install/
+* http://docs.python-requests.org/en/latest/user/install/

0 comments on commit 780fe2d

Please sign in to comment.