Questo metodo deve essere utilizzato dall’OE per effettuare l’invio di una fattura già nel formato XML secondo norme AGID, ma non ancora firmata digitalmente.
curl -X POST https://demows.fatturazioneelettronica.aruba.it/services/invoice/upload \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=' \
-d '{
"dataFile" : "dGVzdA==",
"credential" : "",
"domain" : ""
}'
#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/invoice/upload
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: @"dataFile" value: @"dGVzdA=="];
[json UpdateString: @"credential" value: @""];
[json UpdateString: @"domain" value: @""];
[rest AddHeader: @"Content-Type" value: @"application/json;charset=UTF-8"];
[rest AddHeader: @"Authorization" value: @"Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="];
[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/invoice/upload" 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 *errorCode = 0;
NSString *errorDescription = 0;
NSString *uploadFileName = 0;
errorCode = [jsonResponse StringOf: @"errorCode"];
errorDescription = [jsonResponse StringOf: @"errorDescription"];
uploadFileName = [jsonResponse StringOf: @"uploadFileName"];
{
"errorCode": "",
"errorDescription": "",
"uploadFileName": "IT01787589930_bkemy.xml.p7m"
}