Options

Future-proofing/improving XML-RPC requests

devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
Hey Guys,

A lot of our 3rd XML-RPC applications rely on the order of parameters as the means of identifying parameters, there is a more robust method by which to make these calls.

Instead of calling smumug.login.withPassword...
<?xml version="1.0"?>
<methodCall>
  <methodName>smugmug.login.withPassword</methodName>
  <params>
    <param>
      <value>
        <string>[insert email address]</string>
      </value>
    </param>
    <param>
      <value>
        <string>[insert password]</string>
      </value>
    </param>
    <param>
      <value>
        <string>1.2.0</string>
      </value>
    </param>
    <param>
      <value>
        <string>[insert api key]</string>
      </value>
    </param>
  </params>
</methodCall>

the request can be made like this...
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
  <methodName>smugmug.login.withPassword</methodName>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>EmailAddress</name>
            <value>
              <string>[insert email address]</string>
            </value>
          </member>
          <member>
            <name>Password</name>
            <value>
              <string>[insert password]</string>
            </value>
          </member>
          <member>
            <name>APIKey</name>
            <value>
              <string>[insert api key]</string>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>

with no reliance on parameter order.

Something to think about :D

David
David Parry
SmugMug API Developer
My Photos

Comments

  • Options
    Kevin L. KitchensKevin L. Kitchens Registered Users Posts: 149 Major grins
    edited February 11, 2008
    devbobo wrote:
    Hey Guys,

    A lot of our 3rd XML-RPC applications rely on the order of parameters as the means of identifying parameters, there is a more robust method by which to make these calls.

    Instead of calling smumug.login.withPassword...
    <?xml version="1.0"?>
    <methodCall>
      <methodName>smugmug.login.withPassword</methodName>
      <params>
        <param>
          <value>
            <string>[insert email address]</string>
          </value>
        </param>
        <param>
          <value>
            <string>[insert password]</string>
          </value>
        </param>
        <param>
          <value>
            <string>1.2.0</string>
          </value>
        </param>
        <param>
          <value>
            <string>[insert api key]</string>
          </value>
        </param>
      </params>
    </methodCall>
    

    the request can be made like this...
    <?xml version="1.0" encoding="UTF-8"?>
    <methodCall>
      <methodName>smugmug.login.withPassword</methodName>
      <params>
        <param>
          <value>
            <struct>
              <member>
                <name>EmailAddress</name>
                <value>
                  <string>[insert email address]</string>
                </value>
              </member>
              <member>
                <name>Password</name>
                <value>
                  <string>[insert password]</string>
                </value>
              </member>
              <member>
                <name>APIKey</name>
                <value>
                  <string>[insert api key]</string>
                </value>
              </member>
            </struct>
          </value>
        </param>
      </params>
    </methodCall>
    

    with no reliance on parameter order.

    Something to think about :D

    David

    Does anyone have links to sample C# code on how to make these calls in this manner?
    Kevin L. Kitchens
    "Know me through my lens."
    My smugmug: http://peiklk.smugmug.com
    My site: http://www.photographyvoice.com [POTD, Blog, News, & more!]
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited February 11, 2008
    I say go struct - just let us know before you hit us with it mwink.gif
    "May the f/stop be with you!"
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited February 11, 2008
    Nikolai wrote:
    I say go struct - just let us know before you hit us with it mwink.gif

    Nik,

    It's possible to send like this now with no change on our end.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited February 11, 2008
    devbobo wrote:
    Nik,
    It's possible to send like this now with no change on our end.
    Cheers,
    David
    Great!
    I was planning on some fixup work tonight, so I might as well change this one, too:-)
    "May the f/stop be with you!"
  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited February 12, 2008
    Nikolai wrote:
    Great!
    I was planning on some fixup work tonight, so I might as well change this one, too:-)
    David,
    FWIF S*E v.188 now uses the improved struct format on all the logins.
    "May the f/stop be with you!"
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited February 12, 2008
    Nikolai wrote:
    David,
    FWIF S*E v.188 now uses the improved struct format on all the logins.

    ok cool thumb.gif

    however, structs can be used on all methods calls.
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.