Intel® Cloud Services SDK beta API Reference

The Intel® Cloud Services Platform SDK is a thin JavaScript* library that lets you easily take advantage of Intel Cloud Services in your own web pages and applications.

Referencing the JavaScript Library

APIs

Auth

Commerce

Profile and Users

Location

Context

Catalog

Recommendation

Curation

Errors Handling

Pagination and Navigation

Legal Information

Referencing the JavaScript Library

JavaScript applications that will incorporate the Cloud Services Platform SDK must include the following source reference if you are under development:

<script type="text/javascript" src="https://api.intel.com/js/v1/intel.cloudservices.js"&gt;&lt;/script>

Alternatively, you can use this light and optimized version:

<script type="text/javascript" src="https://api.intel.com/js/v1/intel.cloudservices.min.js"&gt;&lt;/script>

SDK Versions

Several versions of the SDK enable you to choose the one that's best suited to your application. If you're only including Intel Identity Services or Commerce Services calls in an app, for example, you can use the SDK for that service to reduce the size of the app. Each version also has a lighter compressed version, indicated by "min" in the path.

You can reference these as described above; just substitute the path for the version you want to use.

Full SDK

https://api.intel.com/js/v1/intel.cloudservices.js

https://api.intel.com/js/v1/intel.cloudservices.min.js

Intel Identity Services SDK

https://api.intel.com/js/v1/intel.cloudservices.identity.js

https://api.intel.com/js/v1/intel.cloudservices.identity.min.js

Commerce Services SDK

https://api.intel.com/js/v1/intel.cloudservices.commerce.js

https://api.intel.com/js/v1/intel.cloudservices.commerce.min.js

Context Services SDK

https://api.intel.com/js/v1/intel.cloudservices.context.js

https://api.intel.com/js/v1/intel.cloudservices.context.min.js

Catalog Services SDK

https://api.intel.com/js/v1/intel.cloudservices.catalog.js

https://api.intel.com/js/v1/intel.cloudservices.catalog.min.js

Curation Services SDK

https://api.intel.com/js/v1/intel.cloudservices.curation.js

https://api.intel.com/js/v1/intel.cloudservices.curation.min.js

Recommendation Services SDK

https://api.intel.com/js/v1/intel.cloudservices.recommendation.js

https://api.intel.com/js/v1/intel.cloudservices.recommendation.min.js

Note: You can also target the Test development environment with each of these versions by appending :8081, like this: https://api.intel.com:8081/js/v1/intel.cloudservices.js. For more information about the available development environments, see Development Environment Tutorial.

Error Handling

When errors are detected during an API call, they are returned as part of the errorCallback. The following table lists the most common errors.

Note: You might also get an error message that originates with one of the cloud services, rather than the SDK. Error information is provided in the documentation for those services. Please see one of the following for more information on service-based errors.

Errors are returned with this structure:

{
    "code": <"error number">,
    "desc": "<string: brief description about the error>",
    "details": {
        "serviceCode": "<internal code returned by the service, When the service doesn't return this code the SDK returns "
'Unknown'>",
        "httpCode": "<http code returned by the service and 'N/A' when the error is detected by the SDK.>"
    }
}
Error number Error Description
1 NO_TOKEN The access token does not exist.
2 INVALID_METHOD_SEQUENCES This error is passed in a number of situations. It usually indicates that you are not following a certain logic sequence when calling different methods. For example, if the init method was not executed previously, if the system is not already logged in, if a payment method has not been set up, or if a cart has not been saved or purchased.
3 INTERNAL_ERROR This error occurs for a number of reasons, depending on the method. It is often returned because an access token is missing or is invalid. See the API for the method passing this error message for more details.
4 INVALID_PARAMETER A parameter is not valid. Can be returned for a number of different reasons. See the API for the method passing this error message for more details.
5 UNAUTHORIZED This error occurs when you are not authorized to execute the operation. You probably have not specified enough scopes on the login.
6 SERVICE_ERROR This error is reported when there is a service-based problem.

Pagination and Navigation

Many methods return arrays that include navigation by means of pagination. In cases where the returned array contains dozens of items, perhaps 10 items per page, the developer can execute calls to navigate to other pages of items. The navigation methods are:

  • items.next(successCallback, errorCallback): Moves to the next items page by returning the new page in the successCallback.
  • items.previous(successCallback, errorCallback): Moves to the previous items page by returning the previous page in the successCallback.
  • items.position(index, successCallback, errorCallback): Moves to a specific page number (stated by index parameter) by returning that page in the successCallback.

For example, this code obtains carts between two dates and implements next/previous navigation methods.

     var myCartsList,
        options = {range:{startDate: '20120101', endDate: "20131212"}};
    intel.commerce.getCarts(
        options,
        function(carts){
            myCartsList = carts;
            //myCartsList[0];
        },
        errorCallback
    );
    next = function(){
        myCartsList.next(
            function(nextCarts){
                myCartsList = nextCarts;
                //myCartsList[0];
            },
            errorCallback
        );
    }
    previous = function(){
        myCartsList.previous(
            function(previousCarts){
                myCartsList = previousCarts;
                //myCartsList[0];
            },
            errorCallback
        );
    }
 

More SDK Information

Intel Cloud Services SDK beta Developer's Guide

Intel Cloud Services SDK API Reference

Auth

Commerce

Profile and Users

Location

Context

Catalog

Recommendation

Curation

Tutorials

Managing Commerce Carts and Orders

Managing Application Keys

Managing User Profiles

Using Intel® Cloud Services SDK with Apache Cordova

Legal Information