4.7 Find Information about Social Ratings

In this scenario, the current user wants to see the average rating for a document, and then progressively get more information about the social ratings for that document and their social ratings for other documents.

The protocol client starts by sending the following GetRatingAverageOnUrl request (section 3.1.4.21).

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingAverageOnUrl xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <url>http://server.example.com/document</url>
       </GetRatingAverageOnUrl>
    </soap:Body>
 </soap:Envelope>

The protocol server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingAverageOnUrlResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <GetRatingAverageOnUrlResult>
             <Url>http://server.example.com/document</Url>
             <Average>2.75</Average>
             <LastModifiedTime>2009-05-11T17:14:44.26</LastModifiedTime>
             <Count>4</Count>
             <CurrentUserRating>5</CurrentUserRating>
          </GetRatingAverageOnUrlResult>
       </GetRatingAverageOnUrlResponse>
    </soap:Body>
 </soap:Envelope>

The current user now wants to see details for all four social ratings for the document. The protocol client sends the following GetRatingsOnUrl request (section 3.1.4.23).

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingsOnUrl xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <url>http://server.example.com/document</url>
       </GetRatingsOnUrl>
    </soap:Body>
 </soap:Envelope>

The protocol server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingsOnUrlResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <GetRatingsOnUrlResult>
             <SocialRatingDetail>
                <Url>http://server.example.com/document</Url>
                <Owner>USERNAME</Owner>
                <LastModifiedTime>2009-05-08T23:59:06.17</LastModifiedTime>
                <Title>Title</Title>
                <Rating>5</Rating>
             </SocialRatingDetail>
             <SocialRatingDetail>
                <Url>http://server.example.com/document</Url>
                <Owner>USERNAME1</Owner>
                <LastModifiedTime>2009-05-11T17:14:43.683</LastModifiedTime>
                <Title>Title2</Title>
                <Rating>1</Rating>
             </SocialRatingDetail>
             <SocialRatingDetail>
                <Url>http://server.example.com/document</Url>
                <Owner>USERNAME2</Owner>
                <LastModifiedTime>2009-05-11T17:14:44.043</LastModifiedTime>
                <Title>Title3</Title>
                <Rating>2</Rating>
             </SocialRatingDetail>
             <SocialRatingDetail>
                <Url>http://server.example.com/document</Url>
                <Owner>USERNAME3</Owner>
                <LastModifiedTime>2009-05-11T17:14:44.26</LastModifiedTime>
                <Title>Title4</Title>
                <Rating>3</Rating>
             </SocialRatingDetail>
          </GetRatingsOnUrlResult>
       </GetRatingsOnUrlResponse>
    </soap:Body>
 </soap:Envelope>

The current user now wants to know about all the social ratings that were added by a specific user. The protocol client sends the following GetRatingsOfUser request (section 3.1.4.24).

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingsOfUser xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <userAccountName>USERNAME</userAccountName>
       </GetRatingsOfUser>
    </soap:Body>
 </soap:Envelope>

The protocol server sends the following response.

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
       <GetRatingsOfUserResponse xmlns="http://microsoft.com/webservices/SharePointPortalServer/SocialDataService">
          <GetRatingsOfUserResult>
             <SocialRatingDetail>
                <Url>http://server.example.com/document</Url>
                <Owner>USERNAME</Owner>
                <LastModifiedTime>2009-05-08T23:59:06.17</LastModifiedTime>
                <Title>Title</Title>
                <Rating>5</Rating>
             </SocialRatingDetail>
             <SocialRatingDetail>
                <Url>http://server.example.com/document2</Url>
                <Owner>USERNAME</Owner>
                <LastModifiedTime>2009-05-08T23:56:07.21</LastModifiedTime>
                <Title>Title2</Title>
                <Rating>4</Rating>
             </SocialRatingDetail>
          </GetRatingsOfUserResult>
       </GetRatingsOfUserResponse>
    </soap:Body>
 </soap:Envelope>