-
Notifications
You must be signed in to change notification settings - Fork 5
APIv1.Objects
When a list of objects needs to be sent, it will be done so using JSON arrays.
When a moderator needs to be sent by a client, it should be represented as so:
{
"username" : "guy-laurent",
"password" : "1234"
}
When a moderator needs to be sent by the server, it should be represented as so:
{
"idModerator" : "123",
"token" : "abcdefghi"
}
When a token needs to be sent by a client, it should be via the URL:
/ex/ample?token=abcdefghi
When the server needs to send a token, it should be represented as so:
{
"token" : "abcdefghi"
}
When a client needs to send a poll, it should be represented as so:
{
"title" : "My title"
}
When the server needs to send a poll, it should be represented as so:
{
"idModerator" : {idModerator},
"idPoll" : {idPoll},
"title" : "My title"
}
Note: The status
can be either:
-
open
meaning the session is active and people can connect to it -
quarantined
meaning the session is active but people cannot connect to it anymore -
closed
meaning the session is not active anymore
When the client needs to send a session, it should be represented as so:
{
"status" : `open`
}
When the server needs to send a session, it should be represented as so:
{
"idModerator" : {idModerator},
"idPoll" : {idPoll},
"idSession" : {idSession},
"code" : "0xABCD",
"status" : `open`
}
Note: indexInPoll
can be a double
. In which case, the natural number ordering
is to be followed.
When a client needs to send a question, it should be represented as so:
{
"title" : "This is a Question title",
"details" : "Comment",
"visibility" : "hidden",
"indexInPoll" : 1,
"answersMin" : 1,
"answersMax" : 42
}
When the server needs to send a question, it should be represented as so:
{
"idModerator" : {idModerator},
"idPoll" : {idPoll},
"idQuestion" : {idQuestion},
"title" : "This is a Question title",
"details" : "Comment",
"visibility" : "hidden",
"indexInPoll" : 1,
"answersMin" : 1,
"answersMax" : 42
}
visibility
can have one of three values: visible
, hidden
or archived
.
Attributes answersMin
and answersMax
are optionnal.
When a client needs to send an answer, it should be represented as so:
{
"title" : "First answer",
"description" : "This is a description"
}
When the server needs to send an answer, it should be represented as so:
{
"idModerator" : {idModerator},
"idPoll" : {idPoll},
"idQuestion" : {idQuestion},
"idAnswer" : {idAnswer},
"title" : "First answer",
"description" : "This is a description",
"checked" : {boolean, optional}
}
Answers that have been requested with a participant token will get the checked
field, but
moderators will not see any field set.
When a client needs to send a vote for an answer, it should be represented as so:
{
"checked" : true
}
The value of checked
is a boolean and should represent if the answer is selected in the user's UI.
When a moderator needs some basic statistics, he might retrieve some general poll statistics that are represented as so :
[
{
"title": "Question title 1",
"answers" :
[
{ "title": "answer 1", "positive": 123, "negative": 123 },
{ "title": "answer 2", "positive": 123, "negative": 123 },
{ "title": "answer 3", "positive": 123, "negative": 123 }
]
},
{
"title": "Question title 2",
"answers" : []
}
]
An array of question statistics is requested for certain UNIX timestamps. The timestamps consider the current time in seconds.
[
1589128713,
1589128722
]
An array of question statistics is returned for a certain question at a set of different timestamps.
{
"answers":
[
{
"idAnswer" : 1,
"title": "Answer 1"
},
{
"idAnswer" : 2,
"title": "Answer 2"
}
],
"timestamps":
[
{
"seconds": 1589128713,
"votes":
[
{
"idAnswer" : 1,
"count": 123
},
{
"idAnswer" : 2,
"count": 456
}
]
},
{
"seconds": 1589128715,
"votes":
[
{
"idAnswer" : 1,
"count": 123
},
{
"idAnswer" : 2,
"count": 456
}
]
}
]
}