Search code examples
google-apigoogle-slides-apigoogle-python-api

How to discover the method signature of a google api?


I want to use python google api client library to retrieve the data of my google slide. The python code should be equivalent to this REST API call in term of outcome.

GET https://slides.googleapis.com/v1/presentations/GXGXGXGXGXGXGXuf3LAMp0I89qfQYv6ffHRmI?key={YOUR_API_KEY}

So in the frontend/javascript side, I use the picker API to return me a file id. I can use the file id to download the slide as a pdf file

However, when i tried to use the slides api,

http = httplib2.Http()
http_auth = credentials.authorize(http)

slide_service = build('slides', 'v1', http=http_auth)
p = slide_service.presentations(fileId).get()
print p

I get the exception TypeError: methodResource() takes exactly 1 argument (2 given)

I tried to use the file id as parameter of the get method, like so:

p = slide_service.presentations().get(fileId)

Again it failed with this error: TypeError: method() takes exactly 1 argument (2 given)

There is basically no documentation of the function synature of these python APIs. What is the right way to retrieve the slide data?


Solution

  • Based on the API explorer, the get method takes a parameter presentationId

    enter image description here

    So the python code should be

    p = slide_service.presentations().get(presentationId=fileId)