AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi RestRequest with Post Var
Thema durchsuchen
Ansicht
Themen-Optionen

RestRequest with Post Var

Ein Thema von Rabihan35 · begonnen am 25. Apr 2020 · letzter Beitrag vom 27. Apr 2020
Antwort Antwort
Rabihan35

Registriert seit: 25. Apr 2020
3 Beiträge
 
#1

RestRequest with Post Var

  Alt 25. Apr 2020, 19:15
Hi everyone,

I have the following problem, I'm doing a restclient application which will send request to a Restserver API, i was able to connect and getthe responses of my requests,
now the problem is when I'm sending the request with Parameters, the server is ignoring them, or at least the filter parameters are ignored, the required information, which are timestamp, salt and signature are accepted but all others are ignored. as an example from the documentation of the Server's API i have the following php example:

// The GET vars
$GET_VARS = array(
"go" => "clips",
"do" => "list"
);

// The POST vars
$POST_VARS = array(
"fields" => "id,title", // Include only id, and title
"paging" => 1, // Allow paging
"resultsPerPageFilter" => 5, // Return 5 results per page
"current_page" => 1, // Return the page No. 1
"statusFilter" => "any", // Include Clips with any status
"sortByFilter" => "date", // Sort Clips by date (latest first)
"generateEmbedCode" => 1, // Generate embed code for each Clip
"embedWidth" => 400, // Set the Embed code Width = 400px
"embedHeight" => 225, // Set the Embed code Height = 225px
"embedURLVars" => "&autoplay=1" // Include the Video Player vars in the Embed code
);

form delphi I was able to send the get var in addition to the required information and the server response is ok, but I was not able sending the other variables (pos_var)


// get the signature
Signature := getSignature(TimeStamp, Salt);

RESTRequest1.AddParameter('go','clips');
RESTRequest1.AddParameter('do','list');
RESTRequest1.AddParameter('timestamp',TimeStamp);
RESTRequest1.AddParameter('salt',Salt);

RESTRequest1.AddParameter('key',KeyID);

RESTRequest1.AddParameter('signature',Signature); ----> till this point everything is OK

RESTRequest1.AddParameter('fields','title'); ------> this parameter is ignored same as all the others in the POST_VAR!!!!


ResponseMemo.Lines.Add('Request: '+RESTRequest1.GetFullRequestURL(True));
//using Methode = rmGet
RESTRequest1.Execute;
jValue:=RESTResponse1.JSONValue;
ResponseMemo.Text:= jValue.ToString;

I have no idea how to send the POST_VAR shown in the PHP example.

thanks for all the help I get
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.453 Beiträge
 
Delphi 12 Athens
 
#2

AW: RestRequest with Post Var

  Alt 26. Apr 2020, 10:52
I am not familiar with PHP, but you can try this for all $POST_VARS parameter:
Delphi-Quellcode:
...
RESTRequest1.AddParameter('fields','title', TRESTRequestParameterKind.pkREQUESTBODY);
...
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
Rabihan35

Registriert seit: 25. Apr 2020
3 Beiträge
 
#3

AW: RestRequest with Post Var

  Alt 27. Apr 2020, 00:03
thanks for your reply, will try it and let you know.
  Mit Zitat antworten Zitat
Rabihan35

Registriert seit: 25. Apr 2020
3 Beiträge
 
#4

AW: RestRequest with Post Var

  Alt 27. Apr 2020, 01:04
I have no idea why but it still ignoring the parameters. would it work if i use indy instead?
thanks
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.453 Beiträge
 
Delphi 12 Athens
 
#5

AW: RestRequest with Post Var

  Alt 27. Apr 2020, 08:45
It should work with both systems. Do you have a working PHP (or other) solution where you can intercept the request for an analysis?
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  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 12:13 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