TomEd 0 Posted October 4, 2023 I've prototyped a small app using the Delphi REST components. function TForm1.QueryAPI(Resource: string): string; begin RESTRequest1.Resource := Resource; RESTRequest1.Execute; Result := RESTResponse1.JSONValue.GetValue<string>('authorization'); end; procedure TForm1.Button1Click(Sender: TObject); var jValue:TJSONValue; AuthCode, AccessToken: string; begin RestRequest1.AddBody('{"email":"<email>","password":"<password>"}', ctNone); AuthCode := QueryAPI('oauth/authorize'); MemoContent.Lines.Add('auth = ' + AuthCode); end; <email> and <password> are obfuscated intentionally. This all works fine when I omit the RestRequest1.AddBody and use the RestRequest1.Params property as Name = body (followed by 32 hex digits), Value = "email":"<email>","password":"<password>", and Kind = pkRequestBody in the IDE as provided by the REST Debugger. I don't know the significance of the 32 hex digits following "body" in the Name field since it came over from the debugger. Is this the proper way to add the body to RestRequest1 and what might be the significance of the hex digits following "body" (see attached; please excuse my clumsy editing)? Share this post Link to post
Uwe Raabe 2058 Posted October 4, 2023 Can you try to replace the ctNone with ctAPPLICATION_JSON? Share this post Link to post