Skip to content

Syntax of "charge history", and related errors

jumpjack edited this page Oct 9, 2021 · 1 revision

charge-history?start=STARTDATE&end=ENDDATE&type=TYPE

Mandatory parameters:

  • start
  • end
  • type

TYPE = day/month

If TYPE = day: STARTDATE/ENDDATE = YYYMMDD (with day)

If TYPE = month: STARTDATE/ENDDATE = YYYMM (without day)

Errors:

  • "type" omitted:
    "status": "400",
    "code": "NotNull",
    "detail": "must not be null",
    "source": {
        "parameter": "type"
    }

"type" unkwnown:

    "status": "400",
    "code": "typeMismatch",
    "detail": "Failed to convert property value of type 'java.lang.String' to required type 'com.acms.platform.caradapter.datamodel.resource.type.TargetPeriodType' for property 'type'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@javax.validation.constraints.NotNull com.acms.platform.caradapter.datamodel.resource.type.TargetPeriodType] for value 'pippo'; nested exception is java.lang.IllegalArgumentException: No enum constant com.acms.platform.caradapter.datamodel.resource.type.TargetPeriodType.pippo",
    "source": {
        "parameter": "type"
    }

"start" or "end" is not an YYYMMDD or YYYMM string:

{
    "errors": [
        {
            "status": "400",
            "code": "typeMismatch",
            "detail": "Failed to convert property value of type 'java.lang.String' to required type 'java.time.temporal.TemporalAccessor' for property 'start'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@javax.validation.constraints.NotNull @javax.validation.constraints.PastOrPresent @com.acms.platform.caradapter.config.conversion.iso8601.basic.SupportsBasicFormat java.time.temporal.TemporalAccessor] for value 'arg'; nested exception is java.time.format.DateTimeParseException: Text 'arg' cannot be parsed at index 0",
            "source": {
                "parameter": "start"
            }
        },
        {
            "status": "400",
            "code": "TimeComparison",
            "detail": "begin date must be before end date"
        }
    ]
}

STARTDATE/ENDDATE in YYYYMM format when YYYYMMDD is expected (type=day):

{
    "errors": [
        {
            "status": "400",
            "code": "IfValue",
            "detail": "Wrong end time pattern for type DAY, expected yyyyMMdd",
            "source": {
                "parameter": "end"
            }
        },
        {
            "status": "400",
            "code": "IfValue",
            "detail": "Wrong start time pattern for type DAY, expected yyyyMMdd",
            "source": {
                "parameter": "start"
            }
        }
    ]
}

STARTDATE/ENDDATE in YYYYMMDD format whern YYYMM is excpected (type=month):

{
    "errors": [
        {
            "status": "400",
            "code": "IfValue",
            "detail": "Wrong end time pattern for type MONTH, expected yyyyMM",
            "source": {
                "parameter": "end"
            }
        },
        {
            "status": "400",
            "code": "IfValue",
            "detail": "Wrong start time pattern for type MONTH, expected yyyyMM",
            "source": {
                "parameter": "start"
            }
        }
    ]
}

All parameters omitted, replaced by "help":

{
    "errors": [
        {
            "status": "400",
            "code": "NotNull",
            "detail": "must not be null",
            "source": {
                "parameter": "type"
            }
        },
        {
            "status": "400",
            "code": "NotNull",
            "detail": "must not be null",
            "source": {
                "parameter": "start"
            }
        },
        {
            "status": "400",
            "code": "NotNull",
            "detail": "must not be null",
            "source": {
                "parameter": "end"
            }
        }
    ]
}
Clone this wiki locally