Swift Fatturazione Elettronica Aruba IT: Monitor Check

Back to Index

Restituisce il valore del metodo check monitor

Documentation: https://fatturazioneelettronica.aruba.it/apidoc/docs.html#_monitorcheck

CURL Command

curl -X POST  https://demows.fatturazioneelettronica.aruba.it/services/invoice/MonitorCheck \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE='

Swift Example


func chilkatTest() {
    let rest = CkoRest()
    var success: Bool

    //  URL: https://demows.fatturazioneelettronica.aruba.it/services/invoice/MonitorCheck
    var bTls: Bool = true
    var port: Int = 443
    var bAutoReconnect: Bool = true
    success = rest.Connect("demows.fatturazioneelettronica.aruba.it", port: port, tls: bTls, autoReconnect: bAutoReconnect)
    if success != true {
        print("ConnectFailReason: \(rest.ConnectFailReason.intValue)")
        print("\(rest.LastErrorText)")
        return
    }

    rest.AddHeader("Content-Type", value: "application/json")
    rest.AddHeader("Authorization", value: "Bearer NLOGDVXLVaF3tzmnVPkTwpkuh7dG0i09uSCcog3u+rE=")
    rest.AddHeader("Accept", value: "application/json")

    let sbResponseBody = CkoStringBuilder()
    success = rest.FullRequestNoBodySb("POST", uriPath: "/services/invoice/MonitorCheck", sb: sbResponseBody)
    if success != true {
        print("\(rest.LastErrorText)")
        return
    }

    var respStatusCode: Int = rest.ResponseStatusCode.intValue
    if respStatusCode >= 400 {
        print("Response Status Code = \(respStatusCode)")
        print("Response Header:")
        print("\(rest.ResponseHeader)")
        print("Response Body:")
        print("\(sbResponseBody.GetAsString())")
        return
    }

    let jsonResponse = CkoJsonObject()
    jsonResponse.LoadSb(sbResponseBody)

    //  See the Online Tool for Generating JSON Parse Code
    var errorCode: String?
    var errorDescription: String?
    var checkValue: String?

    errorCode = jsonResponse.StringOf("errorCode")
    errorDescription = jsonResponse.StringOf("errorDescription")
    checkValue = jsonResponse.StringOf("checkValue")

}

Sample JSON Response Body

{
  "errorCode": "",
  "errorDescription": "",
  "checkValue": "Service it.arubapec.fatturapa.uploadservice.UploadService STATUS UP"
}