Table of Contents | ||
---|---|---|
|
...
Tip |
---|
When a call takes an optional cart object, the method type will usually change from a 'get' to a 'post', and the post payload will be the cart's json. Don't forget to set the right type if you're passing in the cart. |
/rest/site/stateProvinces
Method | GET | Comments |
---|---|---|
Description | returns back all states for the country provided | This is a convenience function to retrieve all configured states for a country. |
Cookies | none | |
Path Parameters | none |
|
Query Parameters | country | 'United States', 'Canada', etc. |
Headers | none | |
Receives Json | none | |
Returns Json | String Array | Example: [ "Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "Armed Forces Africa", "Armed Forces Americas", "Armed Forces Canada", "Armed Forces Europe", "Armed Forces Middle East", "Armed Forces Pacific", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Federated States of Micronesia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Marshall Islands", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio", "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virgin Islands", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" ] Example for include codes: [{"province":"Alabama","code":"AL"},{"province":"Alaska","code":"AK"},{"province":"American Samoa","code":"AS"}, |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function stateProvinces() { var country = jQuery('#stateProvincesCountry').val() || 'United States'; jQuery.ajax({ url: '/rest/site/stateProvinces', data: {country: country}, type: 'get', headers: {'X-UC-Merchant-Id': 'DEMO', "cache-control": "no-cache"}, // could also pass merchant id as query parameter named '_mid' or cookie named 'UltraCartMerchantId' dataType: 'json' }).done(function (states) { jQuery('#stateProvincesResult').html('<pre>' + JSON.stringify(states, null, ' ') + '</pre>'); }); } jQuery(document).ready(function () { jQuery('#stateProvincesButton').on('click', stateProvinces); }); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<div class='demo'><a class='demo-link' name="demo14"></a> <h4 class='title'>Get State Provinces</h4> <div class='details'> Country: <input type="text" id="stateProvincesCountry" value="United States"/> <input type="button" class='demo-button' value="Get States/Provinces" id="stateProvincesButton"/> <script type="syntaxhighlighter" class="brush: javascript" id="demo-code-display14"></script> Result: <div class="results" id="stateProvincesResult"></div> </div> </div> |
/rest/site/stateProvinceCodes
Method | GET | Comments |
---|---|---|
Description | returns back all state codes for the country provided | This is just like /rest/site/stateProvinces, but it returns back codes instead of long names. |
Cookies | none | |
Path Parameters | none |
|
Query Parameters | country | 'United States', 'Canada', etc. |
Headers | none | |
Receives Json | none | |
Returns Json | String Array | Example: [ "AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY", "AE", "AA", "AE", "AE", "AE", "AP" ] |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function stateProvinceCodes() { var country = jQuery('#stateProvinceCodesCountry').val() || 'United States'; jQuery.ajax({ url: '/rest/site/stateProvinceCodes', data: {country: country}, type: 'get', headers: {'X-UC-Merchant-Id': 'DEMO', "cache-control": "no-cache"}, // could also pass merchant id as query parameter named '_mid' or cookie named 'UltraCartMerchantId' dataType: 'json' }).done(function (statesCodes) { jQuery('#stateProvinceCodesResult').html('<pre>' + JSON.stringify(statesCodes, null, ' ') + '</pre>'); }); } jQuery(document).ready(function () { jQuery('#stateProvinceCodesButton').on('click', stateProvinceCodes); }); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<div class='demo'><a class='demo-link' name="demo15"></a> <h4 class='title'>Get State Province Codes</h4> <div class='details'> Country: <input type="text" id="stateProvinceCodesCountry" value="United States"/> <input type="button" class='demo-button' value="Get States/Provinces" id="stateProvinceCodesButton"/> <script type="syntaxhighlighter" class="brush: javascript" id="demo-code-display15"></script> Result: <div class="results" id="stateProvinceCodesResult"></div> </div> </div> |
/rest/site/storeFront/searchAutoSuggest
Method | GET | Comments |
---|---|---|
Description | returns back suggestions and result items based upon current search | This is just like /rest/site/stateProvinces, but it returns back codes instead of long names. |
Cookies | none | |
Path Parameters | none |
|
Query Parameters | search thumbnailHeight thumbnailWidth | Users search string. Don't submit until 3 characters long. thumbnailHeight/thumbnailWidth take precedence over thumbnailSize. Valid values are: Widths: 80, 100, 200, 220, 250, 500 |
Headers | none | |
Receives Json | none | |
Returns Json | A complex object containing suggestions and results.
| Example: { |
/rest/site/unifiedAffiliateCookieScript
Method | GET | Comments |
---|---|---|
Description | returns back a url that can be used to construct a script element. When run, that script will set cookies to track affiliates across domains. | There's lot of ways to run the script. jQuery makes it easy. |
Cookies | none | |
Path Parameters | none |
|
Query Parameters | secureHostName - the domain you wish to track affiliates on _mid - your Merchant ID (could also use header or cookie - see example) | www.mystorenamehere.com |
Headers | none | |
Receives Json | none | |
Returns Json | This returns a text string, not Json! | Example: https://secure.ultracart.com/checkout/unifiedAffiliateCookie.jsp?merchantId=DEMO&secureHostName=www.mystorenamehere.com |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function unifiedAffiliateScript() { var merchantId = 'DEMO'; var secureHostName = "www.mystorenamehere.com"; jQuery.ajax({ url: '/rest/site/unifiedAffiliateCookieScript', data:{secureHostName: secureHostName}, type: 'get', headers: {'X-UC-Merchant-Id': merchantId, // this is one way to pass MID "cache-control": "no-cache"}, // could also pass merchant id as query parameter named '_mid' or cookie named 'UltraCartMerchantId' dataType: 'text' // NOTE: This returns back plain text! }).done(function (script) { jQuery('#unifiedAffiliateCookieScriptResult').html('<pre>' + script + '</pre>'); }); } jQuery(document).ready(function () { jQuery('#unifiedAffiliateCookieScriptButton').on('click', unifiedAffiliateScript); }); |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<div class='demo'><a class='demo-link' name="demo16"></a> <h4 class='title'>Unified Affiliate Cookie Script</h4> <div class='details'> <input type="button" class='demo-button' value="Get Script" id="unifiedAffiliateCookieScriptButton"/> <script type="syntaxhighlighter" class="brush: javascript" id="demo-code-display16"></script> Result: <div class="results" id="unifiedAffiliateCookieScriptResult"></div> </div> </div> |
/rest/site/advertisingSources
...
Method | GET | Comments | ||
---|---|---|---|---|
Description | search for items, and returns back a paginated result search. |
| ||
Cookies | none | |||
Path Parameters | none |
| ||
Query Parameters |
thumbnailSize thumbnailWidth thumbnailHeight | string, the search term to look for. integer integer this name is used in the url construction (see example results) so that the view urls are already pointing at your server. optional integer: for square thumbnails, one of these values: 80, 100, 200, 220, 250, 500. This is an optional parameter. The default is 80px. Thumbnails are always square. thumbnailHeight/thumbnailWidth take precedence over thumbnailSize. Valid values are: Widths: 80, 100, 200, 220, 250, 500 | ||
Headers | none | |||
Receives Json | none | |||
Returns Json | A complex object containing pagination information and an array of items | Example: { "totalResults": 1, "currentPage": 1, "totalPages": 1, "items": [ { "extendedDescription": "", "description": "BONE", "thumbnailUrl": "1369252924157/DEMO/8/9/80-80-89BDA673BC716255B7EC50069B4A398F.jpg", "cost": 20, "viewUrl": "http://secure.ultracart.com/catalog/DEMO/products/facebook/fb-single/Bone.html", "addToCartUrl": "/cgi-bin/UCEditor?merchantId=DEMO&ADD=Bone" } ] }
|
...
Method | GET | Comments | ||
---|---|---|---|---|
Description | retrieves a list of items | if both ids and url are provided, url is used. | ||
Cookies | none | |||
Path Parameters | none |
| ||
Query Parameters |
url
thumbnailHeight
| &id=item1&id=item2&id=item3
the full url to a catalog group. this must be a valid catalog group. Example: https://secure.ultracart.com/catalog/DEMO/rest_demo/ (the url above will show an ugly page. It was created for the item data, not to serve as a fully functional page. optional integer: convenience parameters for square thumbnails using one of these values: 80, 100, 200, 220, 250, 500. This is an optional parameter. The default is 80px. Thumbnails are always square. thumbnailHeight/thumbnailWidth take precedence over thumbnailSize. Valid values are: Widths: 80, 100, 200, 220, 250, 500 If a cart id is passed in as a query, the associated cart is loaded and referenced. If the cart has a logged in customer (valid customer profile), then any items returned will have their pricing applied.
| ||
Headers | none | |||
Receives Json | none |
| ||
Returns Json | An array of Item objects (see Item definition above) | Example: [ { "cases": [], "minimumQuantity": 1, "maximumQuantity": null, "manufacturerSuggestedRetailPrice": null, "viewUrl": "http://www.testajax.com/catalog/DEMO/products/facebook/fb-single/ATARI2600.html", "options": [], "allowBackorder": false, "preorder": false, "inventoryTracked": false, "availableQuantity": 0, "inStock": true, "itemOid": 3707319, "itemId": "ATARI2600", "description": "Atari 2600", "extendedDescription": "", "cost": 999.99, "weight": null, "length": { "uom": "CM", "value": 0 }, "width": { "uom": "CM", "value": 0 }, "height": { "uom": "CM", "value": 0 }, "attributes": [], "multimedias": [ { "thumbnails": [ { "height": 80, "width": 80, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1347411615246/DEMO/4/6/80-80-466058B5603717FE5D5B2F1302FC06F0.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1347411615246/DEMO/4/6/80-80-466058B5603717FE5D5B2F1302FC06F0.jpg" }, { "height": 100, "width": 100, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1363399269313/DEMO/4/6/100-100-466058B5603717FE5D5B2F1302FC06F0.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1363399269313/DEMO/4/6/100-100-466058B5603717FE5D5B2F1302FC06F0.jpg" }, { "height": 200, "width": 200, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1363399250806/DEMO/4/6/200-200-466058B5603717FE5D5B2F1302FC06F0.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1363399250806/DEMO/4/6/200-200-466058B5603717FE5D5B2F1302FC06F0.jpg" } ], "type": "Image", "default": true, "imageWidth": 600, "imageHeight": 335, "viewUrl": "http://s3.amazonaws.com/ultracart/im/3F44E1FC096C0E0131DF4BBF5B051400?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371107686&Signature=EM5lMfjnmWk4ak2z6DVjEJ2uueg%3D", "description": "", "code": null, "excludeFromGallery": false } ], "defaultImageUrl": "http://s3.amazonaws.com/ultracart/im/3F44E1FC096C0E0131DF4BBF5B051400?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371107686&Signature=EM5lMfjnmWk4ak2z6DVjEJ2uueg%3D", "defaultThumbnailUrl": "http://ultracartthumbs.s3.amazonaws.com/1347411615246/DEMO/4/6/80-80-466058B5603717FE5D5B2F1302FC06F0.jpg", "variations": [] }, ... additional items here ... ]
|
...
Method | GET | Comments | |||
---|---|---|---|---|---|
Description | retrieves a single item |
| |||
Cookies | none | ||||
Path Parameters | item id | this should be a valid merchant item id. For example: /rest/site/items/TSHIRT | Query Parameters | thumbnailSize cartId | optional integer: one of these values: 80, 100, 200, 220, 250, 500. This is an optional parameter. The default is 80px. Thumbnails are always square.|
Query Parameters | thumbnailSize thumbnailWidth thumbnailHeight cartId | optional integer: one of these values: 80, 100, 200, 220, 250, 500. This is an optional parameter. The default is 80px. Use this for square thumbnails, otherwise use both thumbnailWidth and thumbnailHeight thumbnailHeight/thumbnailWidth take precedence over thumbnailSize. Valid values are: Widths: 80, 100, 200, 220, 250, 500
| |||
Headers | none | ||||
Receives Json | none |
| |||
Returns Json | An Item object (see Item definition above) | Example: { "cases": [], "minimumQuantity": 1, "maximumQuantity": null, "manufacturerSuggestedRetailPrice": null, "viewUrl": "http://www.testajax.com/catalog/DEMO/products/facebook/fb-single/PDF.html", "options": [], "allowBackorder": false, "preorder": false, "inventoryTracked": false, "availableQuantity": -33, "inStock": true, "itemOid": 128754, "itemId": "PDF", "description": "PDF Sampler", "extendedDescription": "", "cost": 1, "weight": null, "length": { "uom": "IN", "value": 0 }, "width": { "uom": "IN", "value": 0 }, "height": { "uom": "IN", "value": 0 }, "attributes": [], "multimedias": [ { "thumbnails": [ { "height": 200, "width": 200, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1363189011276/DEMO/F/D/200-200-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1363189011276/DEMO/F/D/200-200-FDDC193869B9EB22A7ADFA776F613062.jpg" }, { "height": 100, "width": 100, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1368717402788/DEMO/F/D/100-100-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1368717402788/DEMO/F/D/100-100-FDDC193869B9EB22A7ADFA776F613062.jpg" }, { "height": 80, "width": 80, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg" } ], "type": "Image", "default": true, "imageWidth": 400, "imageHeight": 400, "viewUrl": "http://s3.amazonaws.com/ultracart/im/317BBF705AEB5C0130BD546683051600?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371108852&Signature=RKlBcOafFfPuTGKovA9g%2FRSlAwo%3D", "description": "pdf icon", "code": null, "excludeFromGallery": false } ], "defaultImageUrl": "http://s3.amazonaws.com/ultracart/im/317BBF705AEB5C0130BD546683051600?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371108852&Signature=RKlBcOafFfPuTGKovA9g%2FRSlAwo%3D", "defaultThumbnailUrl": "http://ultracartthumbs.s3.amazonaws.com/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg", "variations": [] }
|
...
Method | GET | Comments |
---|---|---|
Description | retrieves an array of related items for a given item |
|
Cookies | none | |
Path Parameters | item id |
|
Query Parameters |
thumbnailHeight
|
thumbnailHeight/thumbnailWidth take precedence over thumbnailSize. Valid values are: Widths: 80, 100, 200, 220, 250, 500
|
Headers | none | |
Receives Json |
|
|
Returns Json | An Item object (each related item will be one of these) (see Item definition above) | Example: { "cases": [], "minimumQuantity": 1, "maximumQuantity": null, "manufacturerSuggestedRetailPrice": null, "viewUrl": "http://www.testajax.com/catalog/DEMO/products/facebook/fb-single/PDF.html", "options": [], "allowBackorder": false, "preorder": false, "inventoryTracked": false, "availableQuantity": -33, "inStock": true, "itemOid": 128754, "itemId": "PDF", "description": "PDF Sampler", "extendedDescription": "", "cost": 1, "weight": null, "length": { "uom": "IN", "value": 0 }, "width": { "uom": "IN", "value": 0 }, "height": { "uom": "IN", "value": 0 }, "attributes": [], "multimedias": [ { "thumbnails": [ { "height": 200, "width": 200, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1363189011276/DEMO/F/D/200-200-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1363189011276/DEMO/F/D/200-200-FDDC193869B9EB22A7ADFA776F613062.jpg" }, { "height": 100, "width": 100, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1368717402788/DEMO/F/D/100-100-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1368717402788/DEMO/F/D/100-100-FDDC193869B9EB22A7ADFA776F613062.jpg" }, { "height": 80, "width": 80, "httpUrl": "http://ultracartthumbs.s3.amazonaws.com/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg", "httpsUrl": "https://s3.amazonaws.com/ultracartthumbs/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg" } ], "type": "Image", "default": true, "imageWidth": 400, "imageHeight": 400, "viewUrl": "http://s3.amazonaws.com/ultracart/im/317BBF705AEB5C0130BD546683051600?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371108852&Signature=RKlBcOafFfPuTGKovA9g%2FRSlAwo%3D", "description": "pdf icon", "code": null, "excludeFromGallery": false } ], "defaultImageUrl": "http://s3.amazonaws.com/ultracart/im/317BBF705AEB5C0130BD546683051600?AWSAccessKeyId=0P4TXH5AKGYC8WHDZFG2&Expires=1371108852&Signature=RKlBcOafFfPuTGKovA9g%2FRSlAwo%3D", "defaultThumbnailUrl": "http://ultracartthumbs.s3.amazonaws.com/1369393305697/DEMO/F/D/80-80-FDDC193869B9EB22A7ADFA776F613062.jpg", "variations": [] }
|
...