Intel® Cloud Services SDK beta Profile and User API Reference

intel.profile

getUserProfile

Obtains a UserProfile object containing the complete user profile from the cloud.

getApplicationProfile

Obtains the ApplicationProfile.

UserProfile

Represents the user's profile created in Intel® Identity Services.

UserProfile.Update

Updates the user's profile information to the cloud.

ApplicationProfile

Represents the application's profile of Intel Identity Services.

addKey

Adds a key to the application profile. Requires a previous intel.auth.login.

updateKey

Updates a key in the application profile.

deleteKey

Deletes a key from the application profile.

intel.user

getDetails

Obtains a JSON object from the cloud that contains basic information about the user.

getScopes

Obtains a JSON object from the cloud that contains basic information about a specific user.

JSON Objects

User Details

Used with the getDetails method.

User Scopes

Used with the getScopes method.

intel.profile

Contains APIs for managing user and application specific profiles.

getUserProfile Method

Obtains a UserProfile object containing the complete user profile from the cloud.

The user must be logged in with intel.auth.login before your application can use this method.

Required scope: profile:basic

Syntax

intel.profile.getUserProfile(successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
successCallback yes function The function that is called when the user profile is obtained successfully.
errorCallback yes function The function that is called if the user profile cannot be obtained.

JavaScript Code Example

intel.profile.getUserProfile(
    function(myUserProfile) {
        alert(myUserProfile.basic.firstName);
        },    
    errorCallback);

Errors and Warnings

Error Description
INTERNAL_ERROR Error processing the User Profile response.

getApplicationProfile Method

Obtains the ApplicationProfile object with complete application information from the cloud.

Note: To use this method, you must be logged in using intel.auth.init. For more information, see Intel Cloud Services SDK Auth API Reference.

Syntax

intel.profile.getApplicationProfile(successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
successCallback yes function The function that is called when the application profile is obtained successfully. Should have one parameter to receive the ApplicationProfile object.
errorCallback yes function The function that is called if the application profile cannot be obtained.

JavaScript Code Example

intel.profile.getApplicationProfile(
    function(myAppProfile) {
       //myAppProfile object usage
        },    
    errorCallback);

Errors and Warnings

Error Description
NO_TOKEN The access token does not exist.
INVALID_PARAMETER A parameter is invalid.

UserProfile Object

Represents the user's profile created in Intel Identity Services.

Properties

Property Input/Output? Description
basic Output JSON object that contains the user's firstName and lastName .
personal Output JSON object that contains the user's birthday, maritalStatus, education, occupation, language and gender.
location Output JSON object that contains the user's country, locality, region, street, and zipCode.
telephone Output JSON object that contains the user's mobile, home, and work numbers.

UserProfile Object Methods

update Method

Updates the user's profile information to the cloud. The information that can be updated includes the properties in the UserProfile object, described above.

The user must be logged in before your application can use this method.

Required scope: profile:full:write

Syntax

myUserProfile.update(successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
successCallback yes function The function that is called when the user profile is updated successfully.
errorCallback yes function The function that is called if the user profile cannot be updated.

JavaScript Code Example

intel.profile.getUserProfile(    
    function(myUserProfile) { 
        myUserProfile.basic.firstName = "New name";
        myUserProfile.update(
            function(myUserProfile) {
                alert("User Profile was updated successfully. New first name: " + 
                    myUserProfile.basic.firstName);            
            },            
            errorCallback);
        },
errorCallback);

Errors and Warnings

Error Description
INTERNAL_ERROR Error processing the User Profile object.
INTERNAL_ERROR Error processing the User Profile response.

ApplicationProfile Object

Represents the application's profile of Intel® Identity Services.

ApplicationProfile Object Methods

addKey Method

Adds a key to the application profile. Requires a previous Auth.login.

Syntax

myAppProfile.addKey(key, successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
key yes JSON object Object representing the key to add. Contains key, value, and contentType attributes.
successCallback yes function The function that is called when the key is added successfully.
errorCallback yes function The function that is called if the key cannot be added.

JavaScript Code Example

intel.profile.getApplicationProfile(    
    function(myAppProfile) {        
        myAppProfile.addKey( 
            {            
            key: "newKey", 
            value: "newValue", 
            contentType: "text"        
        },            
            successCallback,            
            errorCallback); 
        },    
    errorCallback);      

Errors and Warnings

Error Description
NO_TOKEN The access token does not exist.
INVALID_PARAMETER A parameter is invalid.

updateKey Method

Updates a key in the application profile.

Syntax

myAppProfile.updateKey(key, successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
key yes JSON object Represents the key to update. Includes the key, value, and contentType attributes.
successCallback yes function The function that is called when the key is updated successfully.
errorCallback no function The function that is called if the key cannot be updated.

JavaScript Code Example

intel.profile.getApplicationProfile(
    function(myAppProfile) {
        myAppProfile.updateKey(
            {
                key: "key",
                value: "updatedValue",
                contentType: "text"
            },
        successCallback,
        errorCallback);
    },
    errorCallback);

Errors and Warnings

Error Description
NO_TOKEN The access token does not exist.
INVALID_PARAMETER A parameter is invalid.

deleteKey Method

Deletes a key from the application profile.

Syntax

myAppProfile.deleteKey(keyName, successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
keyName yes string Name of the key to be removed.
successCallback yes function The function that is called when the key is deleted successfully.
errorCallback no function The function that is called if the key cannot be deleted.

JavaScript Code Example

intel.profile.getApplicationProfile(
    function(myAppProfile) {
        myAppProfile.deleteKey(
            "myKey",
            successCallback,
            errorCallback);
        },
    errorCallback);

Errors and Warnings

Error Description
NO_TOKEN The access token does not exist.
INVALID_PARAMETER A parameter is invalid.

intel.user

Contains APIs for managing user account information.

getDetails Method

Obtains a JSON object from the cloud that contains basic information about the user.

Note: To use this method, it is necessary to be logged in using intel.auth.login.

Required scope: user:details

Syntax

intel.user.getDetails(successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
successCallback yes function The function that is called when the user's details are retrieved successfully. Should have one parameter to receive the User Details JSON object.
errorCallback no function The function to be called if the user's details cannot be retrieved.

JavaScript Code Example

intel.user.getDetails(
    function (userDetails) {
        alert("ClaimId: " + userDetails.claimId);
    },
    errorCallback);

Errors and Warnings

Error Description
INTERNAL_ERROR Error processing the user details response.
NO_TOKEN The access token does not exist. You get this error if you are not logged in.

getScopes Method

Obtains a JSON object from the cloud that contains basic information about specific user scopes. For information on scopes, see Supported Access Scopes.

Syntax

intel.user.getScopes(successCallback, errorCallback);

Input Parameters

Input Required Input Type Description
successCallback yes function The function that is called when the user scopes are retrieved successfully. Should have one parameter to receive the User Scopes JSON object.
errorCallback no function The function to be called if the user scopes cannot be retrieved.

JavaScript Code Example

intel.user.getScopes(
    function (scopes) {
        if (scopes.length > 0) {
            alert("First Scope: " + scopes[0]);
        }
    },
    errorCallback;

Errors and Warnings

Error Description
INTERNAL_ERROR Error processing the user scopes response.
NO_TOKEN The access token does not exist. You get this error if you are not logged in.

JSON Objects - intel.user

User Details

Used with the getDetails method.

Properties

Property Input/Output Description
userID Output ID that established the relation between a user and a given application. One user has different claimIDs for each of his or her applications. Applications do not share claimID information unless the user has granted permission to share this information.
validated Output Can return true, false, or derived. Derived means that this account was validated by an external Identity Provider, such as Facebook.
accounts Output An array of JSON objects, when each object contains provider and userName.
emails Output An array of email accounts.

User Scopes JSON Object

Used with the getScopes method.

Properties

Property Input/Output Description
scopes Output Array with scope names.

More SDK Information

Intel Cloud Services SDK beta Developer's Guide

Intel Cloud Services SDK API Reference

Auth

Commerce

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