Samples > Starter stores > Starter store enhancements > Social Commerce > WebSphere Commerce Dojo Enhancements API > Social Commerce services > REST API


Profiles

The Social Commerce Profile widget uses the REST API to retrieve and modify the information contained in a public user profile that is stored with the social content service provider.

The Profile widget uses the following methods:

GET /profiles

Used when the Profile widget is in Fetch or ProductionRegisterOrFetch mode.

POST /profiles

Used when the Profile widget is in ProductionRegisterOrFetch, Create, or Update mode.

GET /profilesList

Used to retrieve public user profile information in batch mode. It is used by the Blog, PhotoGallery, and Reviews widgets to display author information in conjunction with social content.

REST API for profiles
HTTP method URI Description Data type Query parameters Authenticated user
GET /profiles/<profileId>/blogs/<blogId> Retrieves a profile. profile    
POST /profiles Creates a new profile or updates an existing profile. profile  
GET /profilesList/<profileList> Retrieves a list of profiles by passing a list of user names. The profileList is a URI encoded string that is built by concatenating user names with comma separators.

For example:

  1. Use JavaScript, pass the following string to encodeURIComponent to retrieve the profiles for user1, user2, and user3:

    user1,user2,user3
    

  2. Use the result to contruct a URI:

    URI:/profilesList/user1%2Cuser2%2Cuser3
    

The GET /profilesList method returns a Map of user names to the profile data type.
array of profile    


Data types

The following table lists the data types contained in the REST API for the Profile widget and provides a code snippet to illustrate each data type.
Data type Example
profile

{
"gender": "Male", "location": "New York", "screenname": "Sample User", "avatar":"http://hostname/myphoto.jpg", "birthday": "1990/11/11"
}

Since each service provider has their own requirements for creating and updating profiles, the details required to create a new profile or update an existing profile are dependent on the service provider.

array of profile

GET /profilesList/john%2Cjane
{
"john":{
"gender": "Male", "location": "New York", "screenname":"John Doe"
,"avatar":"http://hostname/john.jpg", "birthday":"1990/11/11"
}, "jane":{
"gender": "Female", "location": "Toronto", "screenname":"JaneD", "avatar":"http://hostname/jane.jpg", "birthday":"1977/10/09"
}
} 

Related reference

Blogs

Photo galleries

Ratings and reviews

Search engine optimized (SEO) content

REST API


+

Search Tips   |   Advanced Search