|
Table of Content
Introduction
Wire Requests
Product Lines
Products
Specifications
Merchandises
Parametric search
Shopping cart (list items)
Shopping cart (add item)
Shopping cart (remove item)
Shopping cart (update quantity)
Accessory
Decision Model
Specification
Combo Query
Wire Token
Examples
List retailer packages and product lines
Get items of a production line
Display detailed information of merchandise
Display detailed content of shopping cart
Search products based on various parameters
Execute an AJAX request to the wire
Add an item to the shopping cart
Remove an item from the shopping cart
Change the quantity of an item in the shopping cart
Make a text search on all products
Combine two queries using a combo query
Glossary
Other languages resources
Ruby on rails
ASP.NET
Java/JSP
Perl
ColdFusion
(back to top)
|
Introduction
This document is intended for any web programmer that needs to use Dakis Wire system. A good knowledge of PHP and JavaScript languages is highly recommended since every example in this document use these languages. It is possible, however, to use any other web programming language to interact with the Wire as long as they provide libraries to send HTTP request, and parse either JSON or YAML data format. Appendix A of this document mentions a few of these libraries.
The Dakis Wire system helps any web developer to handle e-commerce basic data. This data include:
In the next section of this document, we will first examine in detail the syntax of wire request; we will then present a few use-cases to illustrate this syntax. At any point, you may also refer to the glossary at the end of the document to understand some business related words.
Wire Requests
As mentioned in the introduction, querying Dakis Wire is done through HTTP requests. This section of the document explains the Syntax of every possible HTTP-GET request to the Wire.
Product Lines
Syntax: http://wire.mydakis.com/product_line?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
organize_by_package |
Mandatory |
"true" to organize the output by package (category) of decision models, "false" otherwise |
|
search[“text”] |
Optional |
Used to find the given text in parameter in the product description. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Products
Syntax: http://wire.mydakis.com/product?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
products_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first product to include in the search. To add many products models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
presentation |
Mandatory |
Can be:
overview: To just have an overview of the products
detail: To have the detail of the products |
|
search[“text”] |
Optional |
Used to find the given text in parameter in the product description. |
|
search[“spec_value_ids”] |
Optional |
Used after a parametric search to filter the result. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
true to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Merchandises
Syntax: http://wire.mydakis.com/merchandise?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
skus[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first related merchandize SKU number. To add many skus, use &sku[1]=(second sku) , &sku[2]=(3rd sku) and so on. |
|
tags[0] |
Optional |
Used to display retailer specific tag for merchandise. To add many tags, use &tags[1]=(second tag) , &tag[2]=(3rd tag) and so on. |
|
products_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first product to include in the search. To add many products models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
presentation |
Mandatory |
Can be:
overview: To just have an overview of the products
detail: To have the detail of the products |
|
search[text] |
Optional |
Use this to find text in any field of the given product. Search text will pass through every specifications of the product to find the given keyword. |
|
search[spec_value_ids] |
Optional |
Used after a parametric search to filter the result. |
|
accessory_count |
Optional |
"true" to include the accessory count, "false" otherwise. |
|
search[price][max] |
Optional |
Maximum price to be displayed |
|
search[price][min] |
Optional |
Minimum price to be displayed |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Parametric search
Syntax: http://wire.mydakis.com/parametric_search?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
decision_models_guids[0] |
Mandatory |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
minimum_value_count |
Optional |
When setting the minimum_value_count, you filter out specification search when all products shares the same value. For example: if every camera listed are 4 megapixel, it is not useful to search by resolution. |
|
accessory_count |
Optional |
"true" to include the accessory count, "false" otherwise. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Shopping cart (list items)
Syntax: http://wire.mydakis.com/cart?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
session_id |
Mandatory |
Id generated every time a user open a new shopping cart. This id let us manage the cart until the checkout. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Shopping cart (add item)
Syntax: http://wire.mydakis.com/cart/add_item?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
session_id |
Mandatory |
Id generated every time a user open a new shopping cart. This id let us manage the cart until the checkout. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
|
token |
Mandatory for Ajax |
Set the temporary token required by the Wire server to accept request coming from non white listed IP. |
|
merchandise_id |
Mandatory |
Id of the merchandise to be added to the shopping cart. This id is included in the result of the Merchandise query. |
(back to top)
Shopping cart (remove item)
Syntax: http://wire.mydakis.com/cart/remove_item?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
session_id |
Mandatory |
Id generated every time a user open a new shopping cart. This id let us manage the cart until the checkout. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
|
token |
Mandatory for Ajax |
Set the temporary token required by the Wire server to accept request coming from non white listed IP. |
|
item_id |
Mandatory |
Id of the item to be removed from shopping cart. This id is included in the result of the list cart query. This id is different than the merchandise_id. |
(back to top)
Shopping cart (update quantity)
Syntax:
http://wire.mydakis.com/cart/increment?(parameters...)
or
http://wire.mydakis.com/cart/decrement?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
session_id |
Mandatory |
Id generated every time a user open a new shopping cart. This id let us manage the cart until the checkout. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
|
token |
Mandatory for Ajax |
Set the temporary token required by the Wire server to accept request coming from non white listed IP. |
|
item_id |
Mandatory |
Id of the shopping cart item having its quantity updated. This id is included in the result of the list cart query. This id is different than the merchandise_id. |
(back to top)
Accessory
Syntax: http://wire.mydakis.com/accessory?(parameters...)
|
Parameter |
Optional |
Description |
|
retailer_guid |
Mandatory |
Unique ID of your retailer. It is a 32 digits hexadecimal number separated by some "-" |
|
skus[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first
SKU number of the related merchandise. To add many skus, use &sku[1]=(second sku) , &sku[2]=(3rd sku) and so on. |
|
tags[0] |
Optional |
Used to display retailer specific tag for merchandise. To add many tags, use &sku[1]=(second sku) , &sku[2]=(3rd sku) and so on. |
|
products_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first product to include in the search. To add many products models, increase the number between the “[]”. [1] for the second one, [2] for the 3rd one, and so forth. |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
Presentation |
Mandatory |
Can be:
overview: To just have an overview of the products
detail: To have the detail of the products |
|
search[text] |
Optional |
Use this to find text in any field of the given product. Search text will pass through every specifications of the product to find the given keyword. |
|
search[spec_value_ids] |
Optional |
Used after a parametric search to filter the result. |
|
accessory_count |
Optional |
"true" to include the accessory count, "false" otherwise. |
|
search[price][max] |
Optional |
Maximum price to be displayed |
|
Search[price][min] |
Optional |
Minimum price to be displayed |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Decision Model
Syntax: http://wire.mydakis.com/decision_model?(parameters...)
|
Parameter |
Optional |
Description |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
include_specs |
Optional |
"true" when the result should include detailed specification. Otherwise, simply omit this parameter. |
|
include_presentations |
Optional |
"true" when the result should include product presentation. Otherwise, simply omit this parameter. |
|
organize_by_package |
Optional |
"true" when the result should be organized by package (group of product lines). Otherwise, simply omit this parameter. |
|
search[text] |
Optional |
This parameter is used to search decision model based on given text keyword(s). Result is sorted by order of relevance. |
|
search[exact_text] |
Optional |
This parameter is used to search a decision model who’s name match exactly the given search parameter. |
|
count |
Optional |
Maximum number of records to return at a time. Default is 1000. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table as well as "relevance". |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
|
states[] |
Optional |
Used to filter the result by displaying only the results matching a given states. Possible states are:
0 for "In Development"
1 for "Archived"
2 for "Published"
To match multiple states, repeat the parameter for every states. Example: &state[]=1&state[]=2 |
(back to top)
Specification
Syntax: http://wire.mydakis.com/specification?(parameters...)
|
Parameter |
Optional |
Description |
|
include_description |
Optional |
"true" to include detailed description in the result, "false" otherwise. Default is "false". |
|
decision_models_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first decision model to include in the search. To add many decision models, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
presentation |
Optional |
"true" to include detailed description in the result, "false" otherwise. Default is false. |
|
product_guids[0] |
Optional |
Generic unique id (same format than retailer_guid) of the first product to include in the search. To add many products, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
spec_ids[0] |
Optional |
Id of the first specification to include in the search. To add many specifications, increase the number between the "[]". [1] for the second one, [2] for the 3rd one, and so forth. |
|
count |
Optional |
Maximum number of records to return at a time. |
|
offset |
Optional |
Starting point index of the returned records. Example: to return records 20 to 30, you would set the offset to 20 and the count to 10. |
|
lang |
Optional |
Result language filter. Can be either "en" for English or "fr" for French. Default is English. |
|
sort[on] |
Optional |
Set the field to be sorted on. Can be any of the parameter of this table. |
|
sort[asc] |
Optional |
True to set the sorting order ascendant (from lower to higher), false otherwise. Default is false. |
|
format |
Optional |
Output format of data returned by the query. Can be "json", "yaml" or "ruby_binary". Default is json. |
(back to top)
Combo Query
Combo queries simply combine multiple Wire queries in a single http call. This helps lowering network overhead.
Syntax:
http://wire.mydakis.com/combo?queries[QUERY_NAME1][type]=QUERY_TYPE
&queries[QUERY_NAME1][options][OPTION_1]=VALUE_OF_OPTION1
&queries[QUERY_NAME2][options][OPTION_2]=VALUE_OF_OPTION2....
For every sub_query :
a) Choose an arbitrary name (example : « catalog » or « rebates » etc…)
b) Provides all parameters for every queries in an "array” style of URL
Sub query keywords are:
queries[] to specify the related query
queries[NAME_OF_THE_QUERY][type]= to specify the sub type of the query
possible values: accessory, cart, decision_model, merchandise, parametric_search, product,
product_line, specification
queries[NAME_OF_THE_QUERY][options][OPTION_NAME]=for every options of the
sub-queries
Refer to the section combine two queries using a combo query for an example of combo query.
(back to top)
Wire Token
By default, the Wire system only answer requests coming from white listed IP addresses (to get the IP address(es) of your web server(s) added to our white list, contact Dakis customer support). Any HTTP request coming from another IP will be ignored. The only exception to this rule is when an Ajax call needs to be done directly to the Wire server. Ajax call are done directly from the client web-browsers, thus are not part of the white listed IP addresses.
In order to accept these Ajax requests without compromising the security of our servers, we use a temporary randomly generated token. An HTTP request coming from a non white listed IP but carrying the right token will be accepted. After a few minutes, the token is deleted on the wire server side.
Wire tokens are included in the body of every HTTP reply (look for the key “token” in the resulting parsed hashtable). However, for convenience, we also created a request that only returns the token:
Syntax: http://wire.mydakis.com/token (no parameter required)
(back to top)
Examples
We will now put in practice the syntax shown in the previous section and give a few examples on how to use the Wire using PHP and JavaScript code.
List retailer packages and product lines
(back to top)
Get items of a product line
(back to top)
Display detailed information of merchandise
(back to top)
Display detailed content of shopping cart
Note on session_id:
You can provide pretty much any string as the session ID as long as you keep the same one for the whole session. The php function session_id() is probably the easiest solution.
(back to top)
Search product based on various parameters
In this example, we search for cameras between 500$ and 1000$.
(back to top)
Execute an AJAX request to the wire
(back to top)
Add an item to the shopping cart
The easiest way to add or remove items from the shopping cart is through an Ajax (JSON) call using Dakis Wire JavaScript API.
(back to top)
Remove an item from the shopping cart
Removing an item from the shopping cart is pretty much the same procedure than adding it. It is done through and AJAX call.
(back to top)
Change the quantity of an item in the shopping cart
In this example, we have hardcoded the merchandise ID to 296855. In normal usage, that merchandise ID should be coming from another merchandise query previously sent to the wire.
(back to top)
Make a text search on all products
In the following example, we search for every "PowerShot" product. Most relevant products will be shown first.
(back to top)
Combine two queries using a combo query
In this example, we combine the queries of examples 1 and 2. The result will be stored in named array index "query_one" for the first query and "query_two" for the second one. These are arbitrary names (any other word could be used).
(back to top)
Glossary
|
Accessory: |
Type of merchandise who is related to another item. For example, lens is an accessory of camera. |
|
Combo Query: |
A combo query is the combination of multiple queries to the wire into a single tree based query. |
|
Decision Model: |
Decision model are unique category of products. Decision models are shared by all retailers. |
|
GUID: |
Stands for “Global Unique Identifier”. You can refer to http://en.wikipedia.org/wiki/Globally_Unique_Identifier for more information on GUIDs. |
|
Merchandise: |
Merchandise is an instance of a product for a specific retailer. It contains all information of the product that is unique for a given retailer. Price is an example of such retailer specific information. |
|
Package: |
A package is a group of product lines. For example “Printers and Scanners” would be a package including the following product lines “Paper, Ink Cartiges, Scanners, Printers”. |
|
Product: |
A product is a definition, shared by all retailers, of an item. Product only defines the item itself, not the price or other information that is different from one retailer to another. Refer to merchandise for retailer specific information. |
|
Product Line: |
Product line is very similar to decision model, except that it belongs to one retailer only. The list of product lines of a given retailer defines what the decision models available are for this retailer. |
|
Parametric Search: |
Parametric search let the consumer find products by specifying various parameters. For example, you can get all cameras having at least 4 mega pixels by doing a parametric search on resolution. |
|
Retailer: |
Every store using Dakis to sell items or display items for sales is a retailer. Retailers have their own GUID used to identify them. |
|
SKU: |
Stands for Stock-Keeping Unit. It is a unique number identifying a product or a service. Refer to http://en.wikipedia.org/wiki/Stock_Keeping_Unit for more information. |
|
Shopping Cart: |
Shopping cart includes every merchandise and their related quantities a consumer is about to buy. Before the checkout, a consumer may add or remove as many item from its shopping cart. |
|
Specification: |
Specification is detailed information regarding a product. For example, “Resolution” is a specification of every “Camera” and has its value expressed in mega pixels. |
|
Wire token: |
Token sent from the wire that can be reused by AJAX queries directly to the wire afterwards. Any HTTP request made to the wire that are not from white listed IP addresses require this token to be accepted. Request sent directly from white listed server does not require this token. |
(back to top)
Other languages ressources
Ruby on rails
|
HTTP request to the wire:
|
To send HTTP request to the wire, you can use the Net::HTTP object.
|
|
YAML parsing:
|
Parsing YAML data with ruby on rails is pretty straightforward. Simply use YAML::parse() method. It is part of Rails core and does not require any specific gem.
|
|
JSON parsing:
|
Parsing JSON in ruby requires to install the JSON gem (gem install json). Once done, simply use JSON.parse().
|
(back to top)
ASP.NET
(back to top)
Java/JSP
(back to top)
Perl
(back to top)
ColdFusion
(back to top) |