Ricerca una singola fattura per Id
curl -X GET https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/{invoiceId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE='
#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>
CkoRest *rest = [[CkoRest alloc] init];
BOOL success;
// URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/out/{invoiceId}
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;
}
[rest AddHeader: @"Authorization" value: @"Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="];
[rest AddHeader: @"Accept" value: @"application/json"];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/services/invoice/out/{invoiceId}" sb: 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 *id = 0;
NSString *senderDescription = 0;
NSString *senderCountryCode = 0;
NSString *senderVatCode = 0;
NSString *senderFiscalCode = 0;
NSString *receiverDescription = 0;
NSString *receiverCountryCode = 0;
NSString *receiverVatCode = 0;
NSString *receiverFiscalCode = 0;
NSString *invoiceType = 0;
NSString *docType = 0;
NSString *file = 0;
NSString *filename = 0;
NSString *username = 0;
NSString *lastUpdate = 0;
NSString *idSdi = 0;
int i;
int count_i;
NSString *invoiceDate = 0;
NSString *number = 0;
NSString *status = 0;
id = [jsonResponse StringOf: @"id"];
senderDescription = [jsonResponse StringOf: @"sender.description"];
senderCountryCode = [jsonResponse StringOf: @"sender.countryCode"];
senderVatCode = [jsonResponse StringOf: @"sender.vatCode"];
senderFiscalCode = [jsonResponse StringOf: @"sender.fiscalCode"];
receiverDescription = [jsonResponse StringOf: @"receiver.description"];
receiverCountryCode = [jsonResponse StringOf: @"receiver.countryCode"];
receiverVatCode = [jsonResponse StringOf: @"receiver.vatCode"];
receiverFiscalCode = [jsonResponse StringOf: @"receiver.fiscalCode"];
invoiceType = [jsonResponse StringOf: @"invoiceType"];
docType = [jsonResponse StringOf: @"docType"];
file = [jsonResponse StringOf: @"file"];
filename = [jsonResponse StringOf: @"filename"];
username = [jsonResponse StringOf: @"username"];
lastUpdate = [jsonResponse StringOf: @"lastUpdate"];
idSdi = [jsonResponse StringOf: @"idSdi"];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"invoices"] intValue];
while (i < count_i) {
jsonResponse.I = [NSNumber numberWithInt: i];
invoiceDate = [jsonResponse StringOf: @"invoices[i].invoiceDate"];
number = [jsonResponse StringOf: @"invoices[i].number"];
status = [jsonResponse StringOf: @"invoices[i].status"];
i = i + 1;
}
{
"id": "1",
"sender": {
"description": "Aruba SPA",
"countryCode": "ITA",
"vatCode": "6372762541",
"fiscalCode": "N5Hnt9vvMZ"
},
"receiver": {
"description": "Aruba SPA",
"countryCode": "ITA",
"vatCode": "8767263441",
"fiscalCode": "LVZTeOJ8BN"
},
"invoiceType": "FPA12",
"docType": "in",
"file": "ZEdWemRBPT0=",
"filename": "IT07026037883_jtlkl.xml.p7m",
"invoices": [
{
"invoiceDate": "2019-01-21T17:36:21.289+01:00",
"number": "1",
"status": "Inviata"
},
{
"invoiceDate": "2019-01-21T17:36:21.289+01:00",
"number": "2",
"status": "Consegnata"
}
],
"username": "Utente",
"lastUpdate": "2019-01-21T17:36:21.289+01:00",
"idSdi": null
}