proofgeist / generator

Generator - Store, explore, share and create FileMaker Code
MIT License
35 stars 8 forks source link

Script needs altering to work with Google API #11

Closed rwu2359 closed 7 years ago

rwu2359 commented 7 years ago

For the Google API (and maybe others) the parameters set in the Params tab need to become the data in the body, and not just part of the url string

Posting to https://accounts.google.com/o/oauth2/token?client_id=x&client_secret=y&refresh_token=z&grant_type=refresh_token , with the headers of Host: accounts.google.com and Content-Type: application/x-www-form-urlencoded (which is not in the dropdown list BTW) does not work - if you manually set the $data variable to the $queryString and do not add it to the url it works...

Otherwise you get a 405 Method Not Allowed

toddgeist commented 7 years ago

I am sort of aware of this one. We don't handle form data very well. It sort of why I call it JSON API Explorer. Forms aren't JSON. :-)

I think we need to do something like PostMan does, and change the options under Data. We need a form data section there. Params are not the place to put Form data. since there could be a time when you might need query params and form data.

rwu2359 commented 7 years ago

Get that.. but in the spirit of being able to share code you can drop right into your file, which in this case does all the stuff you need with G Calendars... My current solution is to look in the header Content Type for 'form' and then change the parameters to the body not the url..

toddgeist commented 7 years ago

You can of course, do what every you like in this case. But I'll mention that shipping code in a FileMaker File goes against what Generator is trying to do. Instead, the point is to ship code as text files which can be used to generate the code for a given solution.

Text files are better for sharing for a number of reasons. So we'll have a repository of text files for doing things like talking to Calendars.

This is the future and we are going to make it happen :-)