views:

87

answers:

1

Hi all,

I'm trying to incorporate some Gravatar functionality using its XML-RPC API in an iPhone app I'm writing. I grabbed the Cocoa XML-RPC Framework by Eric Czarny (http://github.com/eczarny/xmlrpc) and it works well when I tested it with some of the Wordpress methods. However, when I try to use the Gravatar API, I always receive a response of "Error code: -9 Authentication error". I think I'm constructing the request correctly, but I've been wracking my brain and can't seem to figure it out. Maybe someone has some experience with this API or can see what I'm doing wrong. Here's the call:

<?xml version="1.0">
<methodCall>
  <methodName>grav.addresses</methodName>
  <params>
    <param><value><string>PASSWORD_HERE</string></value></param>
  </params>
</methodCall>

Again, the Cocoa XML-RPC Framework worked like a dream with Wordpress, but it's choking on the Gravatar API for some reason.

Thanks for your help.

A: 

I got this working by looking at a working PHP class, and modifying my Ruby code to match. This is probably not helpful for Objective C, though, so here's the generated XML.

<?xml version="1.0" ?>
<methodCall>
  <methodName>grav.test</methodName>
  <params>
    <param><value><struct>
      <member>
        <name>apikey</name>
        <value>
          <string>API_KEY</string>
        </value>
      </member>
    </struct></value></param>
  </params>
</methodCall>

Hopefully this will be of some assistance to you. For a more detailed look at my particular issue (in Ruby), check out http://www.thoughtsincomputation.com/posts/making-gravatar-work

Update: Note that you can swap the API_KEY for your PASSWORD, but only if you also swap the <name>apikey</name> name with <name>password</name>. That should be obvious I suppose, but it wasn't immediately so to me for whatever reason.

sinisterchipmunk
Thanks! It looks like I may have been way off. I'll try it later today and let you know.
Erik
Thanks so much! It works great!
Erik