Search code examples
parameterslinkedin-apihttp-status-code-400

LinkedIn Video Analytics API - timeRange invalid


Using the linkedIn Video Analytics API, I want to gather analytics about my video post per day.

My request:

https://api.linkedin.com/v2/videoAnalytics?q=entity&entity=urn:li:ugcPost:6662300354706755584&type=VIEWER&timeRange=(start:1588416100,end:1590624000)&aggregation=DAY

However, I keep receiving the following error:

{"message":"Parameter 'timeRange' is invalid","status":400}

I tried changing the timeRange from miliseconds to epoch time, but that did not make a difference. Please, can anyone help to solve this issue here?

Thanks in advance.


Solution

  • You could split the timeRange in two different query string params:

    So, instead of:

    &timeRange=(start:1588416100,end:1590624000)&...
    

    You could use:

    &timeRange.start=1588416100&timeRange.end:1590624000&...
    

    So the final url could be:

    https://api.linkedin.com/v2/videoAnalytics?q=entity&entity=urn:li:ugcPost:6662300354706755584&type=VIEWER&timeRange.start:1588416100&timeRange.end:1590624000&aggregation=DAY
    

    I've tried with success. Hope this works for you

    NB: Remember that timestamp is in milliseconds