cancel
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 https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents

 

This is my ansible resource config:

   - name: Retrieve PowerBI Activity Events
     uri:
       url: "https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime={{ '2020-09-01T00:00:00.000Z' | urlencode }}&endDateTime={{ '2020-09-18T00:00:00Z' | urlencode }}"
       method: GET
       headers:
         Authorization: "Bearer {{ powerbi_access_token }}"
       status_code: 200
       return_content: yes
       validate_certs: no
     register: activity_response

 

Status: New
Comments
Regular 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'

New Member

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

Regular Visitor

Have you tried building a URL similar to what is provided in the examples of the API documentation ?
e.g.  https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2019-08-13T07:55:00.000Z&endDa...

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

 

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

New Member

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