PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_Json
string ls_InvoiceDate
string ls_Number
string ls_Status
string ls_StatusDescription
string ls_ErrorCode
string ls_ErrorDescription
string ls_Id
string ls_SenderDescription
string ls_SenderCountryCode
string ls_SenderVatCode
string ls_SenderFiscalCode
string ls_ReceiverDescription
string ls_ReceiverCountryCode
string ls_ReceiverVatCode
string ls_ReceiverFiscalCode
string ls_InvoiceType
string ls_DocType
string ls_File
string ls_Filename
string ls_Username
string ls_LastUpdate
string ls_CreationDate
string ls_IdSdi
string ls_PdfFile
integer li_PddAvailable
integer i
integer li_Count_i
li_Success = 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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.
loo_Http.AuthToken = "NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE="
loo_Http.SetRequestHeader("Accept","application/json")
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://ws.fatturazioneelettronica.aruba.it/services/invoice/out/getByIdSdi?idSdi=11110&includePdf=true",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "response status code = " + string(li_RespStatusCode)
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.LoadSb(loo_SbResponseBody)
loo_Json.EmitCompact = 1
Write-Debug "Response JSON:"
Write-Debug loo_Json.Emit()
if li_RespStatusCode <> 200 then
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_Json
return
end if
// 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
// }
//
ls_ErrorCode = loo_Json.StringOf("errorCode")
ls_ErrorDescription = loo_Json.StringOf("errorDescription")
ls_Id = loo_Json.StringOf("id")
ls_SenderDescription = loo_Json.StringOf("sender.description")
ls_SenderCountryCode = loo_Json.StringOf("sender.countryCode")
ls_SenderVatCode = loo_Json.StringOf("sender.vatCode")
ls_SenderFiscalCode = loo_Json.StringOf("sender.fiscalCode")
ls_ReceiverDescription = loo_Json.StringOf("receiver.description")
ls_ReceiverCountryCode = loo_Json.StringOf("receiver.countryCode")
ls_ReceiverVatCode = loo_Json.StringOf("receiver.vatCode")
ls_ReceiverFiscalCode = loo_Json.StringOf("receiver.fiscalCode")
ls_InvoiceType = loo_Json.StringOf("invoiceType")
ls_DocType = loo_Json.StringOf("docType")
ls_File = loo_Json.StringOf("file")
ls_Filename = loo_Json.StringOf("filename")
ls_Username = loo_Json.StringOf("username")
ls_LastUpdate = loo_Json.StringOf("lastUpdate")
ls_CreationDate = loo_Json.StringOf("creationDate")
ls_IdSdi = loo_Json.StringOf("idSdi")
ls_PdfFile = loo_Json.StringOf("pdfFile")
li_PddAvailable = loo_Json.BoolOf("pddAvailable")
i = 0
li_Count_i = loo_Json.SizeOfArray("invoices")
do while i < li_Count_i
loo_Json.I = i
ls_InvoiceDate = loo_Json.StringOf("invoices[i].invoiceDate")
ls_Number = loo_Json.StringOf("invoices[i].number")
ls_Status = loo_Json.StringOf("invoices[i].status")
ls_StatusDescription = loo_Json.StringOf("invoices[i].statusDescription")
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_Json