# Facility ID List

**URL:** <https://community.learningequality.org/t/facility-id-list/1792>\
**Category:** Kolibri\
**Created:** [November 6, 2020, 6:55pm UTC](https://community.learningequality.org/t/facility-id-list/1792 "2020-11-06T18:55:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pateljj04](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/pateljj04/32/740_2.png) [@pateljj04](https://community.learningequality.org/u/pateljj04)\
**Post date:** [November 6, 2020, 6:55pm UTC](https://community.learningequality.org/t/facility-id-list/1792/1 "2020-11-06T18:55:05Z")

</div>

## Summary

We have multiple facilities syncing to a centralized server. I have a simple script that checks for internet connectivity and does sync at boot up if there is internet connectivity. Is there a way to get a list of facilities ids that are syncing on that instance of Kolibri. I was able to find a way to pull the default facility id from github comments/issues but am struggling to find how to pull all the facilities ids.

---

<div class="post-metadata">

**Author:** ![shrenik](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/shrenik/32/179_2.png) [@shrenik](https://community.learningequality.org/u/shrenik)\
**Post date:** [November 7, 2020, 4:13am UTC](https://community.learningequality.org/t/facility-id-list/1792/2 "2020-11-07T04:13:19Z")

</div>

@pateljj04 I believe what you are trying to achieve has already been implemented herein - [https://github.com/cyberorg/kolibri-autosync](https://github.com/cyberorg/kolibri-autosync)

---

<div class="post-metadata">

**Author:** ![pateljj04](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/pateljj04/32/740_2.png) [@pateljj04](https://community.learningequality.org/u/pateljj04)\
**Post date:** [November 7, 2020, 10:25pm UTC](https://community.learningequality.org/t/facility-id-list/1792/3 "2020-11-07T22:25:20Z")

</div>

@shrenik - I think this syncs all facilities on the device with the centralized server. I am looking for having only one facility on a device instead of all being on the device.

---

<div class="post-metadata">

**Author:** ![shrenik](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/shrenik/32/179_2.png) [@shrenik](https://community.learningequality.org/u/shrenik)\
**Post date:** [November 9, 2020, 6:09am UTC](https://community.learningequality.org/t/facility-id-list/1792/4 "2020-11-09T06:09:11Z")

</div>

@pateljj04 the script tries to sync whatever facilities are on the device to a target server with a matching “master” facility. So if a learner or coach device has one facility, only that shall get synced. If the device has more than one facility which match with the “master” server then those too will be synced.

Yet do note that all user data is being synced as of the current Kolibri implementation which may not be desirable as the data size grows. Specifying this just so you are aware.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/richard/32/10_2.png) [@richard](https://community.learningequality.org/u/richard)\
**Post date:** [November 9, 2020, 3:24pm UTC](https://community.learningequality.org/t/facility-id-list/1792/5 "2020-11-09T15:24:34Z")

</div>

Hi @pateljj04,

I assume the question is about running a script on the central server where all the facilities are?

If you want to access the list of Facility ids via Python you can use this shell script:

```auto
from kolibri.core.auth.models import Facility
print(Facility.objects.all().values_list("id", flat=True))

```

You can also get a complete list of the facilities on a device from the `/api/auth/facility` endpoint on the device itself.

---

<div class="post-metadata">

**Author:** ![pateljj04](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.learningequality.org/pateljj04/32/740_2.png) [@pateljj04](https://community.learningequality.org/u/pateljj04)\
**Post date:** [November 10, 2020, 2:09pm UTC](https://community.learningequality.org/t/facility-id-list/1792/6 "2020-11-10T14:09:28Z")

</div>

Thanks @richard yep, that is what I was looking for! 🙂
