Delphi ActiveX Fatturazione Elettronica Aruba IT: Get Transmission Info Request

Back to Index

Servizio per l’interrogazione dello stato di una richiesta

Documentation: https://fatturazioneelettronica.aruba.it/apidoc/docs.html#_gettransmissioninforequest

CURL Command

curl -X POST  https://demows.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
  "userName" : "Utente",
  "password" : "Password",
  "requestID" : "Z68Q7T4KZ3"
}'

Delphi ActiveX Example

var
rest: TChilkatRest;
success: Integer;
bTls: Integer;
port: Integer;
bAutoReconnect: Integer;
json: TChilkatJsonObject;
sbRequestBody: TChilkatStringBuilder;
sbResponseBody: TChilkatStringBuilder;
respStatusCode: Integer;
jsonResponse: TChilkatJsonObject;
result: WideString;
error: WideString;
notifyResult: WideString;
elaboratedResult: WideString;
receiptTimestamp: WideString;
fileID: WideString;
fileName: WideString;

begin
rest := TChilkatRest.Create(Self);

//  URL: https://demows.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password
bTls := 1;
port := 443;
bAutoReconnect := 1;
success := rest.Connect('demows.fatturazioneelettronica.aruba.it',port,bTls,bAutoReconnect);
if (success <> 1) then
  begin
    Memo1.Lines.Add('ConnectFailReason: ' + IntToStr(rest.ConnectFailReason));
    Memo1.Lines.Add(rest.LastErrorText);
    Exit;
  end;

//  See the Online Tool for Generating JSON Creation Code
json := TChilkatJsonObject.Create(Self);
json.UpdateString('userName','Utente');
json.UpdateString('password','Password');
json.UpdateString('requestID','Z68Q7T4KZ3');

rest.AddHeader('Content-Type','application/json;charset=UTF-8');
rest.AddHeader('Accept','application/json');

sbRequestBody := TChilkatStringBuilder.Create(Self);
json.EmitSb(sbRequestBody.ControlInterface);
sbResponseBody := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestSb('POST','/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password',sbRequestBody.ControlInterface,sbResponseBody.ControlInterface);
if (success <> 1) then
  begin
    Memo1.Lines.Add(rest.LastErrorText);
    Exit;
  end;
respStatusCode := rest.ResponseStatusCode;
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(rest.ResponseHeader);
    Memo1.Lines.Add('Response Body:');
    Memo1.Lines.Add(sbResponseBody.GetAsString());
    Exit;
  end;

jsonResponse := TChilkatJsonObject.Create(Self);
jsonResponse.LoadSb(sbResponseBody.ControlInterface);

//  See the Online Tool for Generating JSON Parse Code

result := jsonResponse.StringOf('result');
error := jsonResponse.StringOf('error');
notifyResult := jsonResponse.StringOf('notifyResult');
elaboratedResult := jsonResponse.StringOf('elaboratedResult');
receiptTimestamp := jsonResponse.StringOf('receiptTimestamp');
fileID := jsonResponse.StringOf('fileID');
fileName := jsonResponse.StringOf('fileName');

Sample JSON Response Body

{
  "result": "SF01",
  "error": "In elaborazione",
  "notifyResult": "",
  "elaboratedResult": "",
  "receiptTimestamp": "2017-04-18 18:30:30",
  "fileID": "0610103456",
  "fileName": "ITAFUMBWJKFGU_LI_0001.xml"
}