# Stats Endpoint error

**URL:** <https://community.xibo.org.uk/t/stats-endpoint-error/22029>\
**Category:** Developer Experience\
**Created:** [February 22, 2020, 11:50pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029 "2020-02-22T23:50:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjlcloud](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/jjlcloud/32/8948_2.png) [@jjlcloud](https://community.xibo.org.uk/u/jjlcloud)\
**Post date:** [February 22, 2020, 11:50pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/1 "2020-02-22T23:50:13Z")

</div>

I am trying to hit the Stats endpoint and getting an error returned:  
“Unexpected Error, please contact support.”

Log shows: “Each element of the ‘pipeline’ array must be an object Exception Type: MongoDB\Driver\Exception\CommandException”

 ![22%20PM](https://community.xibo.org.uk/uploads/default/original/2X/9/9548a45f46dc621f9798dd28ef34cc3aa8c4f578.png)  
 ![42%20PM](https://community.xibo.org.uk/uploads/default/original/2X/1/14af8be87f556e96c61808e1d6cc7f4bf3bd8f24.png)

---

<div class="post-metadata">

**Author:** ![dan](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/dan/32/9115_2.png) [@dan](https://community.xibo.org.uk/u/dan)\
**Post date:** [February 23, 2020, 4:01pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/2 "2020-02-23T16:01:53Z")

</div>

@ifarzana any ideas?

---

<div class="post-metadata">

**Author:** ![jjlcloud](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/jjlcloud/32/8948_2.png) [@jjlcloud](https://community.xibo.org.uk/u/jjlcloud)\
**Post date:** [February 23, 2020, 4:45pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/3 "2020-02-23T16:45:20Z")

</div>

Well I tried again today with fresh eyes. I tried using the path to pass the params instead of the body…

I don’t get an error but I also don’t get any kind of response… not sure if it’s progress or not…

 ![10%20AM](https://community.xibo.org.uk/uploads/default/original/2X/2/2b597e9e25f36e68ed14e0d9fab45af395a8685d.png) ![30%20AM](https://community.xibo.org.uk/uploads/default/original/2X/a/a25c6d4d7f44eecdd1bc0f1dd2a7f960f8a79bed.png) ![45%20AM](https://community.xibo.org.uk/uploads/default/original/2X/4/4eb64b58af8d00d124af81f298ab9b65b99fecda.png) ![50%20AM](https://community.xibo.org.uk/uploads/default/original/2X/f/f0a6bb0b8917c92ebe987b3f6a806a44a5a8289f.png)

---

<div class="post-metadata">

**Author:** ![jjlcloud](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/jjlcloud/32/8948_2.png) [@jjlcloud](https://community.xibo.org.uk/u/jjlcloud)\
**Post date:** [February 23, 2020, 5:38pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/4 "2020-02-23T17:38:58Z")

</div>

Sorry…  
another item on the same topic of Stats, I am hitting the setenablestats for Layouts, Media and Playlists.  
They work to turn OFF but even though I get “success” status codes it doesn’t seem to change the stat enabled field. not sure if maybe I am missing something else…  
Layouts I am using 1 and 0  
Media and Playlists I am using On and Off

---

<div class="post-metadata">

**Author:** ![ifarzana](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/ifarzana/32/9262_2.png) [@ifarzana](https://community.xibo.org.uk/u/ifarzana)\
**Post date:** [February 24, 2020, 10:53am UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/5 "2020-02-24T10:53:26Z")

</div>

Hello,

The query parameters should be in the Params tab, not in the Body for this GET request. If you want to get stats of a specific type then you send the type parameter otherwise you don’t send it.

 ![image](https://community.xibo.org.uk/uploads/default/original/2X/0/02c989e163d40043625ecf6ea976c3b140fc9899.png)

As for the /library/setenablestat/{mediaId} API, it requires url-encoded data. We have tested the endpoint and all seems to work, here is a screenshot of what it should look like.

 ![EnableStat](https://community.xibo.org.uk/uploads/default/original/2X/9/9d73400132272fffb5b3a03becebd9ef530608d5.png)

---

<div class="post-metadata">

**Author:** ![jjlcloud](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/jjlcloud/32/8948_2.png) [@jjlcloud](https://community.xibo.org.uk/u/jjlcloud)\
**Post date:** [February 24, 2020, 11:24pm UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/6 "2020-02-24T23:24:51Z")

</div>

Thank you @ifarzana!!  
Seems I didn’t try leaving off the Type=All option… I got that working!  
I also didn’t try URLEncoded… I was trying as form data from the Swagger UI it looked like it wanted that.

All is working now! Huzzah!

---

<div class="post-metadata">

**Author:** ![php](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/php/32/13989_2.png) [@php](https://community.xibo.org.uk/u/php)\
**Post date:** [August 8, 2023, 11:48am UTC](https://community.xibo.org.uk/t/stats-endpoint-error/22029/7 "2023-08-08T11:48:01Z")

</div>

hii team i want use mongodb and mysql both in xibo3, is it possible? if yes please share demo code. thnak you
