Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) 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 <CkHttp.h> #include <CkStringBuilder.h> #include <CkJsonObject.h> void ChilkatSample(void) { CkString strOut; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttp http; bool success; // 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("NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="); http.SetRequestHeader("Accept","application/json"); CkStringBuilder sbResponseBody; success = http.QuickGetSb("https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true",sbResponseBody); if (success == false) { strOut.append(http.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } int respStatusCode = http.get_LastStatus(); strOut.append("response status code = "); strOut.appendInt(respStatusCode); strOut.append("\r\n"); CkJsonObject json; json.LoadSb(sbResponseBody); json.put_EmitCompact(true); strOut.append("Response JSON:"); strOut.append("\r\n"); strOut.append(json.emit()); strOut.append("\r\n"); if (respStatusCode != 200) { strOut.append("Failed."); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); 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 char *invoiceDate = 0; const char *number = 0; const char *status = 0; const char *statusDescription = 0; const char *errorCode = json.stringOf("errorCode"); const char *errorDescription = json.stringOf("errorDescription"); const char *id = json.stringOf("id"); const char *senderDescription = json.stringOf("sender.description"); const char *senderCountryCode = json.stringOf("sender.countryCode"); const char *senderVatCode = json.stringOf("sender.vatCode"); const char *senderFiscalCode = json.stringOf("sender.fiscalCode"); const char *receiverDescription = json.stringOf("receiver.description"); const char *receiverCountryCode = json.stringOf("receiver.countryCode"); const char *receiverVatCode = json.stringOf("receiver.vatCode"); const char *receiverFiscalCode = json.stringOf("receiver.fiscalCode"); const char *invoiceType = json.stringOf("invoiceType"); const char *docType = json.stringOf("docType"); const char *file = json.stringOf("file"); const char *filename = json.stringOf("filename"); const char *username = json.stringOf("username"); const char *lastUpdate = json.stringOf("lastUpdate"); const char *creationDate = json.stringOf("creationDate"); const char *idSdi = json.stringOf("idSdi"); const char *pdfFile = json.stringOf("pdfFile"); bool pddAvailable = json.BoolOf("pddAvailable"); int i = 0; int count_i = json.SizeOfArray("invoices"); while (i < count_i) { json.put_I(i); invoiceDate = json.stringOf("invoices[i].invoiceDate"); number = json.stringOf("invoices[i].number"); status = json.stringOf("invoices[i].status"); statusDescription = json.stringOf("invoices[i].statusDescription"); i = i + 1; } SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.