XML(JSON?)-over-HTTP: How to define API?

vasudevram vasudevram at gmail.com
Sun Jul 5 22:14:31 CEST 2009


On Jul 3, 1:11 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> Allen Fowler schrieb:
>
>
>
>
>
>
>
> >> I have an (in-development) python system that needs to shuttle events / requests
> >> around over the network to other parts of itself.   It will also need to
> >> cooperate with a .net application running on yet a different machine.
>
> >> So, naturally I figured some sort of HTTP event / RPC type of would be a good
> >> idea?
>
> >> Are there any modules I should know about, or guidelines I could read, that
> >> could aid me in the design of the API?    
>
> > To clarify:
>
> > Each message would be <1KB of data total, and consist of some structured object containing strings, numbers, dates, etc.
>
> > For instance there would be an "add user" request that would contain one or more User objects each having a number of properties like:
>
> > - Full Name
> > - Username
> > - Password
> > - Email addresses (a variable length array)
> > - Street Address line1
> > - Street Address line1
> > - Street Address line1
> > - City
> > - State
> > - Zip
> > - Sign Up Date
>
> > .... and so on.
>
> > Since I need to work with other platforms, pickle is out...  what are the alternatives?  XML? JSON?
>
> > How should I formally define each of the valid messages and objects?
>
> > Thank you,
>
> Use XMLRPC. Implementations for both languages are available. There is
> no need for formal spec - which is a good thing. You just call the
> server, and it works.
>
> Diez

I second the suggestion of Diez to use XML-RPC. Very simple to learn
and use. Supports structs (as method arguments and method return
values) which can consist of other data types bundled together, also
supports arrays. Just check whether .NET supports XML-RPC.




More information about the Python-list mailing list