'VAriables
Dim endpointUrl As String = "https://www.wix.com/oauth/access"
Dim appID As String = "xxxxxxxxxx" '<- Put your app id here
Dim appSecret As String = "xxxxxxxxxx" '<- put your app secret here
Dim authCode As String = "xxxxxxxxxxx" '<- Put your auth code here
'Prepare map
Dim m As Map
m.Initialize
m.Put("grant_type","authorization_code")
m.put("client_id",appID)
m.put("client_secret",appSecret)
m.put("code",authCode)
'Use map to build json data
Dim json As JSONGenerator
json.Initialize(m)
Dim data As String = json.ToString
Log(data)
'connect to api with data
Dim ok As HttpJob
ok.Initialize("",Me)
ok.PostString(endpointUrl,data)
ok.GetRequest.SetContentType("application/json")
Wait For (ok) Jobdone(ok As HttpJob)
If ok.Success Then
Log("Success")
Log(ok.GetString)
Else
Log("FAiled")
Log(ok.ErrorMessage)
End If