How would I go about building an API converter?

30 views
Skip to first unread message

Alec Taylor

unread,
May 2, 2012, 5:16:46 AM5/2/12
to django...@googlegroups.com

I have multiple different APIs with different schemas serialised in XML or JSON which I need to output as a standardised schema.

Main features needed:

  • Serialisation to XML and JSON
  • Authentication
    • I.e.: can't get/set data unless you have the correct user+pass
  • Role/Scope limitation
    • I.e.: you can't access everything in our database, only what your role allows for
  • Get/set (conversion) between different schemas
    • I.e.: No matter the input API, you can get it formatted in whichever output API you request

Is this the sort of problem Slumber with TastyPie would be best for?

Or are there a different libraries you'd recommend?

Thanks for all suggestions,

Alec Taylor

Nevio Vesic

unread,
May 2, 2012, 7:53:07 AM5/2/12
to django...@googlegroups.com
If I'd go with it, I'd probably go with writing my own simple interface or using https://bitbucket.org/jespern/django-piston/wiki/Home
I'm not so big fan of TastyPie at all

HarpB

unread,
May 2, 2012, 10:52:24 AM5/2/12
to django...@googlegroups.com
I am a big fan of TastyPie. But I don't understand your following requirement:

  • Get/set (conversion) between different schemas
    • I.e.: No matter the input API, you can get it formatted in whichever output API you request

Are you simply trying to create a unified interface for all of you existing APIs? If so, are they using Django models? TastyPie would only be useful for you if you have existing Django Models. You could still use it without having Django models, but then you would have to write lot more of the api code yourself. TastyPie is a full-featured, drop-in API system. It is meant to simply included into your existing code, your attach it to your Django model and it will serve the data associated to the models. It provides all of the RESTful options: GET, POST, DELETE and PUT.


Django-Piston also makes use of django models, but it does not solely relies on it. It provides a very basic interface (in comparison to TastyPie) and you would need to write all of the RESTful request handles yourself.


Both TastyPie and Piston have authentication and authorization system.

Alec Taylor

unread,
May 2, 2012, 12:20:29 PM5/2/12
to django...@googlegroups.com
On Thu, May 3, 2012 at 12:52 AM, HarpB <hsbs...@gmail.com> wrote:
> I am a big fan of TastyPie. But I don't understand your following
> requirement:
>
> Get/set (conversion) between different schemas
>
> I.e.: No matter the input API, you can get it formatted in whichever output
> API you request
>
> Are you simply trying to create a unified interface for all of you existing
> APIs? If so, are they using Django models?

They seem to be mostly written from C#, all the information they are
giving me is an auto-generated schema page with set/get examples in
SOAP [for one service] and XML [for the other]. I suspect that a few
of the others will be in JSON though.

> TastyPie would only be useful for you if you have existing Django Models.
> You could still use it without having Django models, but then you would
> have to write lot more of the api code yourself. TastyPie is a full-featured,
> drop-in API system. It is meant to simply included into your existing
> code, your attach it to your Django model and it will serve the data
> associated to the models. It provides all of the RESTful options: GET,
> POST, DELETE and PUT.
>
>
> Django-Piston also makes use of django models, but it does not solely relies
> on it. It provides a very basic interface (in comparison to TastyPie) and
> you would need to write all of the RESTful request handles yourself.
>
>
> Both TastyPie and Piston have authentication and authorization system.
>

The functionality I'm providing is as follows:

Server1 >[send as SOAP 1.1]>[My Server]>[Server3 receives as XML in
Server3 schema]
Server3>[Send as XML]>[My Server]>[Server1 receives as SOAP 1.1 in
Server1 schema]

However since they will still need to access the data on demand (and
not wait for a set/get operation from another party) I will need to
create models (database) storing all information received.

What would be the best way of doing this?

Would TastyPie still be a good choice, or would Django-Piston [or some
other] better suit this problem?
Reply all
Reply to author
Forward
0 new messages