Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #31  
Antiguo 16-12-2023
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Poder: 20
oscarac Va por buen camino
Cita:
Empezado por oscarac Ver Mensaje
al final cambié a Indy.... y funcionó

les dejo el codigo por si alguien lo necesita

Código Delphi [-]
unit frmMain_f;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  IdMultipartFormData, IdSSLOpenSSL, IdSSLOpenSSLHeaders, Vcl.StdCtrls,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
  IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, system.json;

type
  TForm1 = class(TForm)
    IndCredenciales: TIdHTTP;
    Button1: TButton;
    Memo1: TMemo;
    Label1: TLabel;
    IndCredencialesSSL: TIdSSLIOHandlerSocketOpenSSL;
    Memo2: TMemo;
    IndFile: TIdHTTP;
    IndFileSSL: TIdSSLIOHandlerSocketOpenSSL;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  //lHTTP: TIdHTTP;
  datosPost: TIdMultiPartFormDataStream;
  URL: string;
  response, tk, localfile: string;
  respuesta: TJSONValue;
  RequestBody: TStream;

begin
 localfile := 'd:\desarrollo\concesiones\servicial\aris\envios\LURIN-09052023.txt';
  try

    //Conexion Endpoint Primario
    URL := 'https://zona-api.aris.com.pe/v1/user/signin';


    datosPost := TIdMultiPartFormDataStream.Create;
    datosPost.AddFormField('user', 'user');
    datosPost.AddFormField('password', '***********');
    response := IndCredenciales.Post(URL, datosPost);
    Memo1.Text := response;
    respuesta := TJSonObject.ParseJSONValue(response);
    tk := respuesta.GetValue<string>('data.data.tk');
    Label1.Caption := tk;
    datosPost.Free;
    // Ya estoy conectado

    // Conexion EndPoint Archivo
    // enviar archivo
    URL := 'https://zona-api.aris.com.pe/v1/concesionario/masivo';
    IndFile.Request.CustomHeaders.FoldLines := False;
    indFile.Request.CustomHeaders.Add('Authorization:Bearer ' + tk);
    datosPost := TIdMultiPartFormDataStream.Create;
    datosPost.AddFile('archivo', localfile, 'multipart/form-data');
    Response := IndFile.Post(URL, datosPost);
    Memo2.Text := response;
    datosPost.Free;

  finally
  end;
end;


end.
buenas noches....este tema lo hice porque un cliente queria que se suba informacion a su repositorio en la web y me dá curiosidad saber como es que lo hace... (no hablo del subir la información porque eso ya se solucionó), es decir... como prepara su hosting en la dirección https://zona-api.aris.com.pe/v1/concesionario/masivo para procesar la informacion que recibe...

alguien me entendió?
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Post Con Demora jerry_mdq Tablas planas 35 05-05-2011 19:53:56
POST sin boton ZayDun HTML, Javascript y otros 1 19-04-2008 11:33:46
IBDatase Insert Post Edit Post ariefez Firebird e Interbase 4 12-10-2005 01:53:04
After Post en interbase jgutti Firebird e Interbase 2 09-03-2005 06:00:12
cancelar post?? ebeltete SQL 9 17-06-2004 22:46:19


La franja horaria es GMT +2. Ahora son las 18:53:46.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi