Additional REST Endpoints

119 views
Skip to first unread message

Rok

unread,
Mar 2, 2021, 9:32:38 PM3/2/21
to oTree help & discussion
Hello,

I have been tasked with creating a much simpler admin control panel with pretty much just a big "start experiment" button and some basic information + end results (admin report page).

What are the chances you could add a REST Endpoint for getting some basic information about a room, like the participant and session vars, what stages participants are in, etc.

(Do you perhaps recommend a different approach I could take to display experiment status on a custom webpage?)

Thank you for your help,
Rok

Chris @ oTree

unread,
Mar 2, 2021, 9:35:48 PM3/2/21
to Rok, oTree help & discussion
You can use admin_report to display status of the session.

Sent from my phone

On Mar 3, 2021, at 10:32 AM, Rok <fish.mi...@gmail.com> wrote:

Hello,
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/46ac5ebc-40bb-4577-9cc8-36d91698d15dn%40googlegroups.com.

Rok

unread,
Mar 2, 2021, 9:43:59 PM3/2/21
to oTree help & discussion
Could you elaborate on the admin_report? 

You mean the variables I set during the experiment to later use them to display data in the report tab in the admin control panel? That's the only thing that i found when i searched for "admin_report" in the documentation. 

How would that help me get (real time) status of an experiment to my own (different) webpage, and/or program?

Thank you and best regards,
Rok

Chris @ oTree

unread,
Mar 2, 2021, 9:52:15 PM3/2/21
to Rok, oTree help & discussion
Admin report can show data in real time.

Sent from my phone

> On Mar 3, 2021, at 10:44 AM, Rok <fish.mi...@gmail.com> wrote:
>

Rok

unread,
Mar 3, 2021, 6:06:05 AM3/3/21
to oTree help & discussion
I am sorry Chris but I am not following. Either I am completely misunderstanding your answers, or you're not reading my questions.

Let me give you an example:

I have my oTree server running on experiment.com. I also have an additional webpage (let's say experiment-cpanel.com) to serve as a much simpler control panel. My users log in to the experiment-cpanel, where they have a button "start experiment", which just runs a small JS script that creates a session in a room, like described in https://otree.readthedocs.io/en/latest/misc/rest_api.html.

I now have an active experiment on experiment.com, where participants will connect to the given room, and my user (admin) on the experiment-cpanel.com. They do not wish to use the original admin interface. They would like basic updates on the experiment they started, shown on the experiment-cpanel.com. How can I show them the info? 

I see the REST API has three described endpoints in the documentation right now:
  • Create sessions
  • Add participant vars
  • Add session vars
All 3 seem to be just for setting values and variables. Is there a way for me to for example just request the api to send me all session vars?

I hope this explains my question a bit better.

Best regards, and thanks for the quick answers. :)
Rok

Rok

unread,
Mar 4, 2021, 8:30:21 AM3/4/21
to oTree help & discussion
So, any chance you could add a rest api endpoint that returns session/participant vars?

Is that something I could do myself? Can you point me in the right direction?

Thank you and best regards,
Rok

Rok

unread,
Mar 9, 2021, 10:28:45 AM3/9/21
to oTree help & discussion
Either I didn't notice it before because I was looking at oTree 3.0 docs or you just added it now but I see the API endpoints I asked for above are already in oTree 5.0!

Thank you,
Rok

Reply all
Reply to author
Forward
0 new messages