Automatic encoding rooms

Hi indico users and admins,

Starting the installation of indico from the beginning for my institution, I would like to know if there is an automatic method to add buildings and rooms from a csv file. Let’s say we have ~100 rooms, I would like to avoid using the IU and the mouse.
Should I use indico shell, fill the PostgreSQL DB directly …
Do you have a suggestion?



you could use the same API used by the UI if it’s a one-time thing. just copy the session and csrf tokens from the browser and send the http requests using a library like requests in python.

or you could use indico shell to create Room instances and add them to the correct Location. that’s a good choice if it’s not a one-time thing since you can re-run the script. FWIW, at CERN we use a custom plugin to sync rooms regularly; if you have some central database you could adapt our plugin for it.


It is one-time thing so I will see how to use the API but I will keep in mind the plugin.

the easiest way to find out what to send is creating one room manually and using your browser’s devtools to see what data is sent when saving it

I used the browser’s devtools and see that this data was sent:

{“owner”:“User:1”, “capacity”:20, “verbose_name”:“salle4”, “building”:“Chim”, "floor ":“2”, “number”:“24”, “location_id”:2}

the URL for the POST was /rooms/api/admin/rooms/.

Based on the exmple at

curl --data “username=jdoe&from=2012-12-30T21:30&to=2012-12-30T22:15&reason=meeting&location=CERN&roomid=189” ‘http://indico.server/indico/api/roomBooking/bookRoom.json

I try:

curl --insecure --data “owner=“User:1”&capacity=20&verbose_name=salle3&building=Eco&floor=2&number=25&location_id=2” ‘https://indico-server/rooms/api/admin/rooms/

and I get :

Bad Request

It looks like there was a problem with your current session. Please use your browser's back button, reload the page and try again.


I think this is because an authentication is needed but, I do not see were to set the connection token ak=00000000-0000-0000-0000-000000000000

You need to send a JSON payload - currently you are sending form-encoded data. The easiest way to do so is using the httpie tool (pip install httpie):

http -j post https://indico-server/rooms/api/admin/rooms/ 'Cookie:indico_session=XXX' 'X-CSRF-Token:YYY' 'owner=User:1' 'capacity:=20' 'verbose_name=salle4' 'building=Chim' 'floor=2' 'number=24' 'location_id:=2'

The CSRF token can be found in a <meta ...> tag when viewing any Indico page. You also need to send the indico_session cookie. Use you browser’s developer tools to check the cookies. Note that you cannot use an API key here.

Yes !! this works.
Thanks a lot and Merry Christmas