AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Post json with authentication using NetHTTPClient1 in delphi-xe
Thema durchsuchen
Ansicht
Themen-Optionen

Post json with authentication using NetHTTPClient1 in delphi-xe

Ein Thema von Fantomas · begonnen am 15. Aug 2021 · letzter Beitrag vom 16. Aug 2021
Antwort Antwort
Fantomas

Registriert seit: 31. Aug 2010
1 Beiträge
 
#1

Post json with authentication using NetHTTPClient1 in delphi-xe

  Alt 15. Aug 2021, 18:44
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
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.004 Beiträge
 
Delphi 2009 Professional
 
#2

AW: Post json with authentication using NetHTTPClient1 in delphi-xe

  Alt 16. Aug 2021, 05:56
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
Michael Justin
  Mit Zitat antworten Zitat
Antwort Antwort

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:56 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