The Response class (Gravatar.NET.GravatarServiceResponse) is used by the client to retrieve the details of a successful request or the error details of an unsuccessful one.

Due to the difference between method responses sent back from Gravatar several response properties are exposed by the response object:

Response Property Used for methods Description
IntegerResponse Test As it name suggests, the response in this case is numerical
BooleanResponse DeleteUserImage As it name suggests, the response in the case is either true or false
ImagesResponse UserImages A list of GravatarUserImage objects representing the images associated with the account
MultipleOperationResponse UseUserImage, Exists Used for methods that return an array of Boolean responses
AddressesResponse Addresses A list of GravatarAddress objects representing the addresses associated with the account
SaveResponse SaveData, SaveUrl The result of saving a new image to Gravatar either by direct upload or with a URL

Using the response properties mentioned above is the best way to process the result of a request made through one of the methods.

The Response object also exposes the collection of parameters that were returned from the Gravatar server, depending on the method called the collection
will contain a different number and types of Parameters), the parameters are exposed using the ResponseParameters property.

In addition, the Response object also allows insight into the raw XML returned from the Gravatar server by using the GravatarResponseXml property.


It's possible that a request will fail to execute for several reasons, it could be that there is a network issue between the client and the Gravatar server or perhaps invalid values are passed into a method call.

When that happens, the response object's IsError property will return true and the information of the error will be passed through the ErrorCode and ErrorInfo properties.

ErrorCode : Will hold the identifier either returned from Gravatar with the following possible values:

-7 Use
-8 Internal error
-9 Authentication error
-10 Method parameter missing
-11 Method parameter incorrect
-100 Misc error (see text)

Or -1000 indicating that the error occurred on the client side, most likely due to a network error.

ErrorInfo : Will hold a more descriptive information about the error that occurred.

Last edited Jul 11, 2010 at 3:54 PM by yoavniran, version 2


No comments yet.