Ver Mensaje Individual
  #1  
Antiguo 27-09-2021
mpg mpg is offline
Registrado
 
Registrado: nov 2017
Posts: 2
Reputación: 0
mpg Va por buen camino
Enviar Json A Webservice

BUENOS DIAS,
NECESITO ENVIAR A UN WEBSERVICE 2 PARAMETROS ( user , secret_key ) JSON , PERO ME ERROR HTTP/1.1 500 Internal Server Error.
ENVIO FUENTE .
GRACIAS

Código Delphi [-]
  restclient1.BaseURL := 'aqui pongo la url donde envio';
  RESTClient1.ContentType := 'ctAPPLICATION_JSON';
  s := '{ "user": "1111","secret_key": "11111" }';
  RESTRequest1.Method := TRESTRequestMethod.rmPOST;
  RESTRequest1.ADDBODY(S);
  RESTRequest1.Params.AddItem; //Adds a new Parameter Item
  RESTRequest1.Params.Items[0].Value := s; //Adds the value of the parameter, in this case, the JSON data.
  RESTRequest1.Params.Items[0].ContentType := ctAPPLICATION_JSON; //sets the content type.
  RESTRequest1.Params.Items[0].Kind := pkGEToRPOST; //sets the kind of request that will be executed.
  restrequest1.Execute;

Última edición por Neftali [Germán.Estévez] fecha: 27-09-2021 a las 16:24:59.
Responder Con Cita