Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

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

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


allen.fowler at yahoo

Jul 2, 2009, 3:06 PM

Post #1 of 8 (543 views)
Permalink
XML(JSON?)-over-HTTP: How to define API?

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?


Thank you,
:)




--
http://mail.python.org/mailman/listinfo/python-list


allen.fowler at yahoo

Jul 2, 2009, 3:17 PM

Post #2 of 8 (525 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

> 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,
:)





--
http://mail.python.org/mailman/listinfo/python-list


clp2 at rebertia

Jul 2, 2009, 3:27 PM

Post #3 of 8 (529 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

On Thu, Jul 2, 2009 at 3:06 PM, Allen Fowler<allen.fowler [at] yahoo> wrote:
>
> 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?

http://en.wikipedia.org/wiki/Representational_State_Transfer
(aka REST)

O'Reilly also has a book on the subject.

Cheers,
Chris
--
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


http://phr.cx at NOSPAM

Jul 2, 2009, 3:29 PM

Post #4 of 8 (527 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

Allen Fowler <allen.fowler [at] yahoo> writes:
> Since I need to work with other platforms, pickle is out... what
> are the alternatives? XML? JSON?

json is the easiest to prototype with and is less bureaucratic. xml
has more serious tools for schema specification and validation etc.
You could start with json and switch later. As for the rpc mechanism,
using urllib and one of the HTTP server modules is probably simplest.
--
http://mail.python.org/mailman/listinfo/python-list


charles at declareSub

Jul 2, 2009, 3:30 PM

Post #5 of 8 (524 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

On Jul 2, 2009, at 6:06 PM, Allen Fowler wrote:

>
> 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?
>
>
> Thank you,
> :)

I'd suggest the O'Reilly book "RESTful Web Services".

Charles Yeomans
--
http://mail.python.org/mailman/listinfo/python-list


deets at nospam

Jul 3, 2009, 1:11 AM

Post #6 of 8 (528 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

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
--
http://mail.python.org/mailman/listinfo/python-list


kd at kendyck

Jul 3, 2009, 10:00 AM

Post #7 of 8 (520 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

On Jul 2, 6:17 pm, Allen Fowler <allen.fow...@yahoo.com> wrote:
> Since I need to work with other platforms, pickle is out...  what are the alternatives?  XML? JSON?

Don't forget YAML (http://yaml.org). Libraries available for Python
and .NET, among others.

-Ken
--
http://mail.python.org/mailman/listinfo/python-list


vasudevram at gmail

Jul 5, 2009, 1:14 PM

Post #8 of 8 (474 views)
Permalink
Re: XML(JSON?)-over-HTTP: How to define API? [In reply to]

On Jul 3, 1:11 pm, "Diez B. Roggisch" <de...@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.

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.