lcGoogleDrive, Livecode for FM, etc.

Monte Goulding monte at appisle.net
Sat Nov 19 17:51:48 EST 2016


> On 20 Nov. 2016, at 9:15 am, Roger Eller <roger.e.eller at sealedair.com> wrote:
> 
> I have no use at all for FM, but a lcGoogleDrive would be just wonderful.

Cool, with the OAuth2 library + JSON <-> Array web services aren’t that complicated. It’s largely just a matter or reading the API docs from there to see how to do what you want to do.

Here’s the example from the OAuth2 library which posts a message to slack:

constant kAuthURL = "https://slack.com/oauth/authorize"
constant kTokenURL = "https://slack.com/api/oauth.access"
constant kClientID = "XXXXXXXXX.XXXXXXXX"
constant kClientSecret = "XXXXXXXXXXXXXXXXXXXXX"
constant kScopes = "incoming-webhook"

OAuth2 kAuthURL, kTokenURL, kClientID, kClientSecret, kScopes, 54303
if the result is not empty then
   answer error "Not authorized!" 
else
   local tAuth
   put it into tAuth
   local tMessage
   ask question "What do you want to send?"
   if it is empty then
      exit mouseUp
   end if
   
   put it into tMessage["text"]
   put ArrayToJSON(tMessage) into tMessage
   
   set the httpHeaders to "Content-type: application/json" & \
         return & "Authorization: token " & sAuth["access_token"]
   post tMessage to url tAuth["incoming_webhook"]["url"]
end if


More information about the use-livecode mailing list