Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Post json with authentication using NetHTTPClient1 in delphi-xe (https://www.delphipraxis.net/208554-post-json-authentication-using-nethttpclient1-delphi-xe.html)

Fantomas 15. Aug 2021 18:44

Post json with authentication using NetHTTPClient1 in delphi-xe
 
I am trying to access kodi via json using NetHTTPClient1 with no success ...

this is my code:

Code:
var
Strm: TStringStream;

begin

Strm := tstringstream.Create(Edit_send.text, tencoding.UTF8);

Strm.WriteString('');

Strm.Position := 0;

self.NetHTTPClient1.Accept := 'application/json';

self.NetHTTPClient1.ContentType := 'application/json; charset=utf-8';//application/json

self.NetHTTPClient1.AcceptEncoding := 'UTF-8';

self.NetHTTPClient1.Post('http://admin:mypw@192.168.1.1:8080/Jsonrpc',Strm,nil).ContentAsString(tencoding.UTF8);
how can i solve?

thank you

mjustin 16. Aug 2021 05:56

AW: Post json with authentication using NetHTTPClient1 in delphi-xe
 
Which error message do you get?

Welche Fehlermeldung erscheint?

With basic auth, user name and password should be set as a http request header.


Authentication: Basic <credentials>

See https://developer.mozilla.org/en-US/.../Authorization


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:11 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz