Trying to get CDR import API working


#1

I’m trying to get the CDR import API working, but when I send my file to the demo server, I get the following error:
[
{
“attribute”: “type”,
“error”: “Empty type”
}
]
My request is as follows:
{
“data”: [
[“61730672133”, “2018-10-15 03:32:49”, 19, “8523”, “23”],
[“61730672133”, “2018-10-15 03:37:31”, 48, “6508”, “23”],
],
“columns”: [“source”, “datetime”, “duration”, “destination”, “comment”],
“params”: [{“type”: “call”}]
}


#2

Turns out the API documentation is wrong. the params isn’t an array of objects, it’s a single object. Also durations are strings rather than numbers.

    {
    "data": [
    ["61730672133", "2018-10-15 03:32:49", "19", "8523<censored>", "23"],
    ["61730672133", "2018-10-15 03:37:31", "48", "6508<censored>", "23"],
    ],
    "columns": ["source", "datetime", "duration", "destination", "comment"],
    "params": {"type": "call"}
    }

should work. Notice the params. I haven’t tested whether quoting the duration has any effect, but it works when you do.