Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/WebServices/CURLS oAuth
Function:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/WebServices/CURLS oAuth
This example is the version from Mon, 27th May 2018.
Project "CURLS oAuth.rbp"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() DoDownload End EventHandler
End Control
Control ResultText Inherits Label
ControlInstance ResultText Inherits Label
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
Private Sub DoDownload() const ConsumerKey = "xxx" const ConsumerSecret = "xxx" const AccessToken = "xxx" const AccessTokenSecret = "xxx" const URL = "http://xxxxx/index.php/rest/V1/customers/123" const Method = "GET" dim Parameters() as string = array("abc=hello", "test=world") dim HTTPHeaders() as string = array( "Accept: application/json") dim d as new CURLSMBS if not d.SetupOAuth(ConsumerKey, ConsumerSecret, AccessToken, AccessTokenSecret, Method, URL, Parameters, HTTPHeaders) then break end if // run download dim e as integer = d.Perform // check result dim s as string = d.OutputData // fix text encoding if s.Encoding <> nil then // ok? elseif encodings.UTF8.IsValidData(s) then s = DefineEncoding(s, Encodings.UTF8) else s = DefineEncoding(s, encodings.ISOLatin1) end if // fix line endings s = ReplaceLineEndings(s, EndOfLine) TextArea1.text = s ResultText.text="Result: "+str(e) dim DebugMessage as string = d.DebugData // check in debugger on error if e <> 0 then // fix text encoding if DebugMessage.Encoding <> nil then // ok? elseif encodings.UTF8.IsValidData(DebugMessage) then DebugMessage = DefineEncoding(DebugMessage, Encodings.UTF8) else DebugMessage = DefineEncoding(DebugMessage, encodings.ISOLatin1) end if // fix line endings DebugMessage = ReplaceLineEndings(DebugMessage, EndOfLine) TextArea1.text = DebugMessage Break end if End Sub
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS CURL Plugin.




Links
MBS Xojo Chart Plugins