LOCAL CallRESTWebService(BaseUrl : Text;Method : Text;RestMethod : Text;HttpContent : DotNet "System.Net.Http.HttpContent";VAR HttpResponseMessage : DotNet "System.Net.Http.HttpResponseMessage") HttpClient := HttpClient.HttpClient(); HttpClient.DefaultRequestHeaders.Authorization := AuthenticationHeaderValue.AuthenticationHeaderValue('Bearer',GetToken); MediaTypeWithQualityHeaderValue := MediaTypeWithQualityHeaderValue.MediaTypeWithQualityHeaderValue('application/json'); HttpClient.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue); CASE RestMethod OF 'GET' : HttpResponseMessage := HttpClient.GetAsync(Method).Result; 'POST' : HttpResponseMessage := HttpClient.PostAsync(Method,HttpContent).Result; 'PUT' : HttpResponseMessage := HttpClient.PutAsync(Method,HttpContent).Result; 'DELETE' : HttpResponseMessage := HttpClient.DeleteAsync(Method).Result; END; HttpResponseMessage.EnsureSuccessStatusCode();
Answers
Try to use "Uri" method instead of headers. Include "access_token=XXXXXXXXXXXXXXXXXXXX" in your request address - "https://your-address.com/something?access_token=XXXXXXXXXX&something_else=1"
Just a question in the line below the variable AccessToken is 'Bearer ' + the acces token, right ?
Regards.
My approach was the following
Works for me
https://forum.mibuso.com/discussion/75345/generic-list-and-x-www-form-urlencoded-rest-api#latest