Home > Uncategorized > AvatarAPI.com – Get a name and profile pic from a #Gmail address

AvatarAPI.com – Get a name and profile pic from a #Gmail address


Do you find that your users never upload decent profile images?, and you end up with pages with lots of default silhouette icons in place of profile pics?, or perhaps you have a database with plenty of email addresses, but no name to put to them – so you end up sending out emails with “Dear Sir or Madam” instead of “Dear Mr James Smith” , this service at AvatarAPI.com allows you to use a simple API to solve those problems.

It’s easy to implement in either PHP, C#, or any other language that can make a HTTP request and parse XML.

HTTP useage

You can call this via any client capable of making a HTTP request, in it’s simplist form, you make a GET request as follows


(where xxxx is your username and password)

And you will receive XML as follows


<profile xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns=”http://avatarapi.com/”&gt;

<Name>Peter Smith</Name>







PHP implementation

You can call the webservice via PHP using code such as the following:

Replacing the xxxxx with your username and password.



$client = new SoapClient(“http://www.avatarapi.com/avatar.asmx?wsdl&#8221;);

$params = array (

   “email” => “john.reid@gmail.com”,

   “username” => “xxxxx”,

   “password” => “xxxxxx”


$response = $client->__soapCall(‘GetProfile’, array($params));




C# implementation

To use C# to call this API, you must first add a web service reference to your project by right clicking Add > Service Reference, and entering the url http://www.avatarapi.com/avatar.asmx

You can call the namespace “Avatar”, for the purposes of this example, then just add this code into a console app;

Replacing the xxxxx with your username and password.


var avatar = new avatarSoapClient();

var profile = avatar.GetProfile(“john.reid@gmail.com”, “xxxx”, “xxxx”);




Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: