Hello!
I have a problem with a GET query.
POST queries work without any problem while GET has an authorization error. My code:
procedure GetProductInfo(_ItemId: Integer; _Token: Text) var Client: HttpClient; Request: HttpRequestMessage; Response: HttpResponseMessage; Headers: HttpHeaders; Uri: Text; FullToken: Text; ResponseTxt: Text; Json: JsonObject; begin Uri := 'https://myaddress.com/product/' Format(_ItemId); FullToken := 'Bearer ' Format(_Token); Request.Method := 'GET'; Request.SetRequestUri(Uri); Headers.Add('Authorization', FullToken); Request.GetHeaders(Headers); Client.Send(Request, Response); if Response.IsSuccessStatusCode() then begin Response.Content.ReadAs(ResponseTxt); Json.ReadFrom(ResponseTxt); ProductId := GetJsonTextField(Json, 'product_id'); ProductCode := GetJsonTextField(Json, 'code'); Evaluate(Stock, GetJsonTextField(Json, 'stock')); Message('Good'); end else Message('Bad'); end;
Error: HTTP 401
Everything works fine in Postman.
Best Regards