PHP Classes

POST to Google Tasks -> Error, parsing form-encoded input

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  POST to Google Tasks -> Error,...  >  (Un) Subscribe thread alerts  
Subject:POST to Google Tasks -> Error,...
Summary:400 API does not support parsing form-encoded input.
Messages:3
Author:Justin
Date:2014-11-18 05:30:45
 

  1. POST to Google Tasks -> Error,...   Reply   Report abuse  
Picture of Justin Justin - 2014-11-18 05:30:46
Hello, thanks for the class... i'm trying to figure out how to use the POST method against Google Tasks, and this is what i'm posting, but i'm getting back an error. Any thoughts?

Array
(
[url] => https://www.googleapis.com/tasks/v1/lists/MDEyNzk3MTI4NDgzOTIwODMxNDM6MDow/tasks
[method] => POST
[params] => Array
(
[title] => Hello World
)
[options] => Array
(
[FailOnAccessError] => 1
)
)

I am trying to post this to Google Tasks, but I keep getting the error back,

ERRORit was not possible to access the API call: it was returned an unexpected response status 400 Response: { "error": { "errors": [ { "domain": "global", "reason": "parseError", "message": "This API does not support parsing form-encoded input." } ], "code": 400, "message": "This API does not support parsing form-encoded input." } }

I'm not enirely sure how to adjust this error. I can 'GET' information, but POSTING doesn't seem to work well.

Any help would be greatly appreciated.

  2. Re: POST to Google Tasks -> Error,...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-18 05:48:02 - In reply to message 1 from Justin
The Tasks API documentation says that you have to send a task resource as request body. You should use the RequestBody parameter and eventually the RequestContentType to specify the MIME type probably 'application/json'.

developers.google.com/google-apps/t ...

  3. Re: POST to Google Tasks -> Error,...   Reply   Report abuse  
Picture of Justin Justin - 2014-11-18 06:00:05 - In reply to message 2 from Manuel Lemos
Ahh yeah that worked right away.
Right on, so far so good then. First time using oAuth (behind the times). Thanks.