I wrote the following javascript to create a to-do list in Google:
postdata = {'title': 'netsuit list'}; Access_token = 'xxxx'; Url = 'https://www.googleapis.com/tasks/v1/users/@me/lists'; Header ['content-type'] = 'app / jason'; Header ['authorization'] = 'beerer' + access_token; Header ['content-length'] = 25; Feedback = $$ RequestURL (URL, PostData, Header, 'Post'); The response says:
{"error": {"errors": [{"domain" : "Global", "cause": "parseError", "message": "This API does not support parsing the form-encoded input." }], "Code": 400, "message": "This API does not support parsing the form-encoded input." }} What could be a possible error?
Data sent like you:
title = Netsuite% 20List But Google API waits for this:
{"title": "Netsuite List"} < Try rendering output to p> requestURL method: postData = JSON.stringify ({'title': 'netsuit list'}); // & lt; - JSON.stringify access_token = 'xxxx'; Url = 'https://www.googleapis.com/tasks/v1/users/@me/lists'; Header ['content-type'] = 'app / jason'; Header ['authorization'] = 'beerer' + access_token; Header ['content-length'] = 25; Feedback = $$ RequestURL (URL, PostData, Header, 'Post'); In addition, it is better to get the documentation or source of the $$ object used by you and check that it supports sending JSON data. Could.
No comments:
Post a Comment