Creazione richiesta di trasmissione “Comunicazioni Finanziarie” in formato zip.
curl -X POST https://testws.fatturazioneelettronica.aruba.it/services/ClientRequest/CreateTransmissionRequestList?username=Utente&password=Password \
-H 'Accept: application/json' \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{
"userName" : "Utente",
"password" : "Password",
"userID" : "Utente",
"comunicationType" : "LI",
"dataFile" : "dGVzdA=="
}'
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
integer li_RespStatusCode
oleobject loo_JsonResponse
string ls_ErrorCode
string ls_ErrorDescription
string ls_RequestID
integer i
integer li_Count_i
string ls_FileName
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://testws.fatturazioneelettronica.aruba.it/services/ClientRequest/CreateTransmissionRequestList?username=Utente&password=Password
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("testws.fatturazioneelettronica.aruba.it",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
// See the Online Tool for Generating JSON Creation Code
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateString("userName","Utente")
loo_Json.UpdateString("password","Password")
loo_Json.UpdateString("userID","Utente")
loo_Json.UpdateString("comunicationType","LI")
loo_Json.UpdateString("dataFile","dGVzdA==")
loo_Rest.AddHeader("Content-Type","application/json;charset=UTF-8")
loo_Rest.AddHeader("Accept","application/json")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("POST","/services/ClientRequest/CreateTransmissionRequestList?username=Utente&password=Password",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
li_RespStatusCode = loo_Rest.ResponseStatusCode
if li_RespStatusCode >= 400 then
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
Write-Debug "Response Header:"
Write-Debug loo_Rest.ResponseHeader
Write-Debug "Response Body:"
Write-Debug loo_SbResponseBody.GetAsString()
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.LoadSb(loo_SbResponseBody)
// See the Online Tool for Generating JSON Parse Code
ls_ErrorCode = loo_JsonResponse.StringOf("errorCode")
ls_ErrorDescription = loo_JsonResponse.StringOf("errorDescription")
ls_RequestID = loo_JsonResponse.StringOf("requestID")
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("requestIDList")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_FileName = loo_JsonResponse.StringOf("requestIDList[i].fileName")
ls_RequestID = loo_JsonResponse.StringOf("requestIDList[i].requestID")
i = i + 1
loop
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JsonResponse
{
"errorCode": "",
"errorDescription": "",
"requestID": "YWWCED5QWHU7AQGL",
"requestIDList": [
{
"fileName": "ITADFSREETDSD_LI_0001.xml",
"requestID": "4LMW5CCCBLXKS522"
},
{
"fileName": "ITADFSREETDSD_LI_0002.xml",
"requestID": "62LXGBLXJCDEAX3M"
},
{
"fileName": "ITADFSREETDSD_LI_0003.xml",
"requestID": "GBJDXIYJSWMRKQBP"
}
]
}