Showing results for 
Search instead for 
Did you mean: 

Activity Event APIs is unusable (Object must implement IConvertible)

Hello, when issuing example query to Activity Events API i'm getting the following response:

    "json": {
        "error": {
            "code": "BadRequest",
            "details": [
                    "message": "Object must implement IConvertible.",
                    "target": "startDateTime"
                    "message": "Object must implement IConvertible.",
                    "target": "endDateTime"
            "message": "Bad Request"

This is the output from Ansible, but i'm getting the same response through the Try It at


This is my ansible resource config:

   - name: Retrieve PowerBI Activity Events
       url: "{{ '2020-09-01T00:00:00.000Z' | urlencode }}&endDateTime={{ '2020-09-18T00:00:00Z' | urlencode }}"
       method: GET
         Authorization: "Bearer {{ powerbi_access_token }}"
       status_code: 200
       return_content: yes
       validate_certs: no
     register: activity_response


Status: New
Frequent Visitor

You can only retrieve 24 hrs of activity events. Ex:
startDateTime = '2020-09-17T00:00:00.000Z'
endDateTime = '2020-09-17T23:59:59.000Z'

Not applicable

Still getting exactly the same error with date range lower than 24h

Frequent Visitor

Have you tried building a URL similar to what is provided in the examples of the API documentation ?

In these examples, there are no "{{...| urlencode }}". 


Maybe also worth noting, in your example, the second parameter ends with '.00Z' and not '.000Z'.

Not applicable

urlencode in Ansible converts special characters to their url-safe representation, eg: whitespace to %20, added it because i was trying different formats, doesn't make a difference for the given examples.

and answering your suggestion it doesn't make any difference whether i add microseconds part or not, still getting the same error

Resolver II

@Anonymous I figured this issue out. It is because you must encapsulate the startDateTime and endDateTime in single quotaion marks as shown below:


Hope this helps! I was going crazy trying to figure it out as well.

Also keep in mind that as of now you can only pull this type of data within 24 hours of the start and end DateTime.

Regular Visitor

BFernandez solved my issue, using single quote for dates works for me as well.