http://code.google.com/p/gdata-python-client/source/browse/#svn/trunk/v3
!! This is a prototype and not production ready !!
At Google I/O we explained what we learned from building APIs at Google and how
we have taken that learning and rolled it into a new infrastructure
for building APIs.
The Buzz, Moderator and Latitude APIs are all built on that new infrastructure.
http://code.google.com/events/io/2010/sessions/how-google-builds-apis.html
One of the key pieces enabled by that new infrastructure is discovery,
a document
that describes each API. For example:
http://www.googleapis.com/discovery/0.1/describe?api=buzz&apiVersion=1&pp=1
That is a JSON document that describes the Buzz API, and you get similar
documents for Latitude and Moderator:
http://www.googleapis.com/discovery/0.1/describe?api=moderator&apiVersion=1&pp=1
http://www.googleapis.com/discovery/0.1/describe?api=latitude&apiVersion=1&pp=1
It is very early days for discovery, and that's reflected in the '0.1'
version number. Expect the
discovery document to change rapidly and in non-backward compatible ways.
One of the benefits of discovery is that it allows very lightweight
client libraries.
That's where this version 3 client comes in, it is built from the
ground up to use
discovery. Using httplib2, python-oath2, and the uri-templates
libraries, along with the discovery
document means that the actual code for the client is very small;
apiclient.py is less that 200 lines of code.
There is a design document for the direction I'd like to see the library take:
http://code.google.com/p/gdata-python-client/wiki/V3ClientDesign
You can look in the README file in the v3 directory for instructions on how to
run the current code.
I've released this very rough and early to get feedback as early as
possible, so
please let me know what you think.
Thanks,
-joe
There are two parts to that, discovering which services are available,
which is coming.
Then there is discovery for the discovery service, which is itself a
discovery based API:
http://www.googleapis.com/discovery/0.1/describe?api=discovery
That part is already done.
> I'm also keen to
> see discovery documents linked to from an HTML page (e.g., my google
> buzz profile page would have head/link/@rel=service that would point
> at the pertinent discovery doc).
That's an interesting idea, it might also make a good candidate
to add to our experimental WebFinger service.
Thanks,
-joe
Ah, that would be a combination of several things. First, there's a
bug, line 154 should be:
return self._model.response(*self._http.request(url,
method=httpMethod, headers=headers, body=body))
If that line were correct you would pass the entity to send as the
'body' parameter
in the method call. You can see the 'body' parameter added to the methods
documentation in the design doc.
The other thing is that as of right now the discovery document doesn't provide
a schema for what the object to POST should look like. When it does
I expect to add _body() member functions, such as insert_body(), that
would return
an instantiated object of the right shape for passing into insert().
See the Model discussion in the design doc:
http://code.google.com/p/gdata-python-client/wiki/V3ClientDesign#Model
> I suspect it is something like:
>
> resp = p.activities().insert(resource=resource,userId='@me')
>
> But I cannot quite puzzle out from the code how to create that
> resource (resource = '{"data":{"object":
> {"type":"note","content":"trying out gdata client v3"}}}') did not
> work.
>
> Any chance of getting a short sample snippet for that operation? With
> a couple of examples I think I'll be able to triangulate a bit a to
> get my head around the new discovery (JSON/WADL?) approach.
>
> Sorry if this is not the proper forum for my question!
This is the right forum for these questions.
Thanks,
-joe
> --
> You received this message because you are subscribed to the Google Groups "GData Python Client Library Contributors" group.
> To post to this group, send email to gdata-python-client-...@googlegroups.com.
> To unsubscribe from this group, send email to gdata-python-client-librar...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gdata-python-client-library-contributors?hl=en.
>
>
Glad to hear about the discovery doc providing a prototype of the
resource -- that was a quite confusing aspect of this whole approach,
which is now making more sense.
Still need to wrap my head around the implications here -- JSON seems
perfect for such a WADLish approach. The biggest implication is that
this seems to remove the (otherwise quite necessary) reliance on
well-documented media types in a RESTful ecosystem. While (hopefully)
avoiding the tight bindings & other problems w/ SOAP/WS-*, etc.
--peter
You can see the changes to the spec here:
Thanks,
-joe