JSON format issue on /usage api


#1

We are calling the usage API http://dev.datasift.com/docs/api/rest-api/endpoints/usage to get DPU informations and It seems to be a problem with the JSON serializations when the api is called for a new stream that has no matching articles over a period that was requested. In this specific case, the licenses field is an empty array instead of an object as in normal cases:

a942c9a0260ca36e165b59bd32bb644e: {
    licenses: [ ],
    seconds: 300
}

In normal cases the JSON looks like follow (please notice that in this case the “licenses” is not an array):

a942c9a0260ca36e165b59bd32bb644e: {
    "licenses": {
        "gender": 1,
        "instagram": 1,
        "interaction": 1,
        "language": 1
    },
    seconds: 300
}

We are currently forced to tweak the deserialization of this object which is failing when array starting is reached, could this be addressed so we/others don’t need workaround this in the future? Thanks!


#2

Thanks for reporting this. I’ve raised a bug report with our Product team for consideration


#3

This will be resolved with API v1.5, which will be announced soon