Sample code for 30+ languages & platforms
Xbase++

Aruba Fatturazione Elettronica GetTransmissionInfoRequest

See more Aruba Fatturazione Examples

Query the status of a request.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL oJson
LOCAL oResp
LOCAL oSbResponseBody
LOCAL oJResp
LOCAL nRespStatusCode

nSuccess := 0

//  This example assumes the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oHttp := CreateObject("Chilkat.Http")

//  Implements the following CURL command:

//  curl -X POST https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest \
//    -H "Accept: application/json" \
//    -H "Content-Type: application/json;charset=UTF-8" \
//    -d '{
//    "userName" : "ARUBA0000",
//    "password" : "ArubaPwd",
//    "requestID" : "UYZCDNDYKQ"
//  }'

//  Use the following online tool to generate HTTP code from a CURL command
//  Convert a cURL Command to HTTP Source Code

//  Use this online tool to generate code from sample JSON:
//  Generate Code to Create JSON

//  The following JSON is sent in the request body.

//  {
//    "userName": "ARUBA0000",
//    "password": "ArubaPwd",
//    "requestID": "UYZCDNDYKQ"
//  }

oJson := CreateObject("Chilkat.JsonObject")
oJson:UpdateString("userName", "ARUBA0000")
oJson:UpdateString("password", "ArubaPwd")
oJson:UpdateString("requestID", "UYZCDNDYKQ")

oHttp:SetRequestHeader("Content-Type", "application/json;charset=UTF-8")
oHttp:SetRequestHeader("Accept", "application/json")

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpJson("POST", "https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/GetTransmissionInfoRequest", oJson, "application/json", oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oJson:destroy()
    oResp:destroy()
    RETURN
ENDIF

oSbResponseBody := CreateObject("Chilkat.StringBuilder")
oResp:GetBodySb(oSbResponseBody)

oJResp := CreateObject("Chilkat.JsonObject")
oJResp:LoadSb(oSbResponseBody)
oJResp:EmitCompact := 0

? "Response Body:"
? oJResp:Emit()

nRespStatusCode := oResp:StatusCode
? "Response Status Code = " + Str(nRespStatusCode)
IF (nRespStatusCode >= 400)
    ? "Response Header:"
    ? oResp:Header
    ? "Failed."
ELSE
    ? "Success."
ENDIF

oHttp:destroy()
oJson:destroy()
oResp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()