Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(C) Aruba Fatturazione Elettronica getByIdSdiSee more Aruba Fatturazione ExamplesThis method returns the complete status detail of an electronic invoice. Search for a single invoice by SdI identifier. For more information, see https://fatturazioneelettronica.aruba.it/apidoc/docs.html#services-invoice-out-getByIdSdi
#include <C_CkHttp.h> #include <C_CkStringBuilder.h> #include <C_CkJsonObject.h> void ChilkatSample(void) { HCkHttp http; BOOL success; HCkStringBuilder sbResponseBody; int respStatusCode; HCkJsonObject json; const char *invoiceDate; const char *number; const char *status; const char *statusDescription; const char *errorCode; const char *errorDescription; const char *id; const char *senderDescription; const char *senderCountryCode; const char *senderVatCode; const char *senderFiscalCode; const char *receiverDescription; const char *receiverCountryCode; const char *receiverVatCode; const char *receiverFiscalCode; const char *invoiceType; const char *docType; const char *file; const char *filename; const char *username; const char *lastUpdate; const char *creationDate; const char *idSdi; const char *pdfFile; BOOL pddAvailable; int i; int count_i; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttp_Create(); // 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. CkHttp_putAuthToken(http,"NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="); CkHttp_SetRequestHeader(http,"Accept","application/json"); sbResponseBody = CkStringBuilder_Create(); success = CkHttp_QuickGetSb(http,"https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true",sbResponseBody); if (success == FALSE) { printf("%s\n",CkHttp_lastErrorText(http)); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); return; } respStatusCode = CkHttp_getLastStatus(http); printf("response status code = %d\n",respStatusCode); json = CkJsonObject_Create(); CkJsonObject_LoadSb(json,sbResponseBody); CkJsonObject_putEmitCompact(json,TRUE); printf("Response JSON:\n"); printf("%s\n",CkJsonObject_emit(json)); if (respStatusCode != 200) { printf("Failed.\n"); CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(json); 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. errorCode = CkJsonObject_stringOf(json,"errorCode"); errorDescription = CkJsonObject_stringOf(json,"errorDescription"); id = CkJsonObject_stringOf(json,"id"); senderDescription = CkJsonObject_stringOf(json,"sender.description"); senderCountryCode = CkJsonObject_stringOf(json,"sender.countryCode"); senderVatCode = CkJsonObject_stringOf(json,"sender.vatCode"); senderFiscalCode = CkJsonObject_stringOf(json,"sender.fiscalCode"); receiverDescription = CkJsonObject_stringOf(json,"receiver.description"); receiverCountryCode = CkJsonObject_stringOf(json,"receiver.countryCode"); receiverVatCode = CkJsonObject_stringOf(json,"receiver.vatCode"); receiverFiscalCode = CkJsonObject_stringOf(json,"receiver.fiscalCode"); invoiceType = CkJsonObject_stringOf(json,"invoiceType"); docType = CkJsonObject_stringOf(json,"docType"); file = CkJsonObject_stringOf(json,"file"); filename = CkJsonObject_stringOf(json,"filename"); username = CkJsonObject_stringOf(json,"username"); lastUpdate = CkJsonObject_stringOf(json,"lastUpdate"); creationDate = CkJsonObject_stringOf(json,"creationDate"); idSdi = CkJsonObject_stringOf(json,"idSdi"); pdfFile = CkJsonObject_stringOf(json,"pdfFile"); pddAvailable = CkJsonObject_BoolOf(json,"pddAvailable"); i = 0; count_i = CkJsonObject_SizeOfArray(json,"invoices"); while (i < count_i) { CkJsonObject_putI(json,i); invoiceDate = CkJsonObject_stringOf(json,"invoices[i].invoiceDate"); number = CkJsonObject_stringOf(json,"invoices[i].number"); status = CkJsonObject_stringOf(json,"invoices[i].status"); statusDescription = CkJsonObject_stringOf(json,"invoices[i].statusDescription"); i = i + 1; } CkHttp_Dispose(http); CkStringBuilder_Dispose(sbResponseBody); CkJsonObject_Dispose(json); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.