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

Diez B. Roggisch deets at nospam.web.de
Fri Jul 3 04:11:02 EDT 2009


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



More information about the Python-list mailing list