Unicode C++
Unicode C++
Aruba Fatturazione Elettronica getByIdSdi
See more Aruba Fatturazione Examples
This method returns the complete status detail of an electronic invoice. Search for a single invoice by SdI identifier.Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// Implements the following CURL command:
// curl -X GET https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true \
// -H "Accept: application/json" \
// -H "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// Adds the "Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=" header.
http.put_AuthToken(L"NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=");
http.SetRequestHeader(L"Accept",L"application/json");
CkStringBuilderW sbResponseBody;
success = http.QuickGetSb(L"https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true",sbResponseBody);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
int respStatusCode = http.get_LastStatus();
wprintf(L"response status code = %d\n",respStatusCode);
CkJsonObjectW json;
json.LoadSb(sbResponseBody);
json.put_EmitCompact(true);
wprintf(L"Response JSON:\n");
wprintf(L"%s\n",json.emit());
if (respStatusCode != 200) {
wprintf(L"Failed.\n");
return;
}
// Sample response:
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
// {
// "errorCode" : "0000",
// "errorDescription" : null,
// "id" : "1",
// "sender" : {
// "description" : "Aruba SPA",
// "countryCode" : "IT",
// "vatCode" : "22222222",
// "fiscalCode" : "11111111111"
// },
// "receiver" : {
// "description" : "Aruba SPA",
// "countryCode" : "IT",
// "vatCode" : "4444444",
// "fiscalCode" : "333333333"
// },
// "invoiceType" : "FPR12",
// "docType" : "in",
// "file" : "dGVzdA==",
// "filename" : "IT01879020517_jtlk0.xml.p7m",
// "invoices" : [ {
// "invoiceDate" : "2021-08-24T12:35:45.363+02:00",
// "number" : "2021/0001",
// "status" : "Inviata",
// "statusDescription" : ""
// } ],
// "username" : "Utente",
// "lastUpdate" : "2021-08-24T10:35:45.363+0000",
// "creationDate" : "2021-08-24T10:35:45.363+0000",
// "idSdi" : "11110",
// "pdfFile" : "ZEdWemRGQmtaZz09",
// "pddAvailable" : true
// }
//
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
// See this example explaining how this memory should be used: const char * functions.
const wchar_t *invoiceDate = 0;
const wchar_t *number = 0;
const wchar_t *status = 0;
const wchar_t *statusDescription = 0;
const wchar_t *errorCode = json.stringOf(L"errorCode");
const wchar_t *errorDescription = json.stringOf(L"errorDescription");
const wchar_t *id = json.stringOf(L"id");
const wchar_t *senderDescription = json.stringOf(L"sender.description");
const wchar_t *senderCountryCode = json.stringOf(L"sender.countryCode");
const wchar_t *senderVatCode = json.stringOf(L"sender.vatCode");
const wchar_t *senderFiscalCode = json.stringOf(L"sender.fiscalCode");
const wchar_t *receiverDescription = json.stringOf(L"receiver.description");
const wchar_t *receiverCountryCode = json.stringOf(L"receiver.countryCode");
const wchar_t *receiverVatCode = json.stringOf(L"receiver.vatCode");
const wchar_t *receiverFiscalCode = json.stringOf(L"receiver.fiscalCode");
const wchar_t *invoiceType = json.stringOf(L"invoiceType");
const wchar_t *docType = json.stringOf(L"docType");
const wchar_t *file = json.stringOf(L"file");
const wchar_t *filename = json.stringOf(L"filename");
const wchar_t *username = json.stringOf(L"username");
const wchar_t *lastUpdate = json.stringOf(L"lastUpdate");
const wchar_t *creationDate = json.stringOf(L"creationDate");
const wchar_t *idSdi = json.stringOf(L"idSdi");
const wchar_t *pdfFile = json.stringOf(L"pdfFile");
bool pddAvailable = json.BoolOf(L"pddAvailable");
int i = 0;
int count_i = json.SizeOfArray(L"invoices");
while (i < count_i) {
json.put_I(i);
invoiceDate = json.stringOf(L"invoices[i].invoiceDate");
number = json.stringOf(L"invoices[i].number");
status = json.stringOf(L"invoices[i].status");
statusDescription = json.stringOf(L"invoices[i].statusDescription");
i = i + 1;
}
}