Objective-C 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"
}'

Objective-C Example

#import <CkoRest.h>
#import <CkoJsonObject.h>
#import <CkoStringBuilder.h>
#import <NSString.h>

CkoRest *rest = [[CkoRest alloc] init];
BOOL success;

//  URL: https://demows.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"demows.fatturazioneelettronica.aruba.it" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
    NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
    NSLog(@"%@",rest.LastErrorText);
    return;
}

//  See the Online Tool for Generating JSON Creation Code
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"userName" value: @"Utente"];
[json UpdateString: @"password" value: @"Password"];
[json UpdateString: @"requestID" value: @"Z68Q7T4KZ3"];

[rest AddHeader: @"Content-Type" value: @"application/json;charset=UTF-8"];
[rest AddHeader: @"Accept" value: @"application/json"];

CkoStringBuilder *sbRequestBody = [[CkoStringBuilder alloc] init];
[json EmitSb: sbRequestBody];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestSb: @"POST" uriPath: @"/services/ClientRequest/GetTransmissionInfoRequest?username=Utente&password=Password" requestBody: sbRequestBody responseBody: sbResponseBody];
if (success != YES) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

int respStatusCode = [rest.ResponseStatusCode intValue];
if (respStatusCode >= 400) {
    NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",rest.ResponseHeader);
    NSLog(@"%@",@"Response Body:");
    NSLog(@"%@",[sbResponseBody GetAsString]);
    return;
}

CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];

//  See the Online Tool for Generating JSON Parse Code
NSString *result = 0;
NSString *error = 0;
NSString *notifyResult = 0;
NSString *elaboratedResult = 0;
NSString *receiptTimestamp = 0;
NSString *fileID = 0;
NSString *fileName = 0;

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"
}