Get Elements
Get all elements of the specified event.
Elements are returned in chronological order according their publishing time.
Get Elements
GET
https://environment.monterosa.cloud/api/v2/events/:event_id/elements
Path Parameters
event_id
string
Event ID.
Query Parameters
filter[state]
string
Filter elements by element timeline state. Possible values: non_scheduled
, future
, cancelled
, current
, on_demand
, past
, revoked
. In order to filter elements by multiple states, provide them separated by commas.
filter[include_in_latest_results]
boolean
Filter elements in order to display only those that are included in latest results. Possible values: true
, false
.
include
string
Include additional relation to the response. For example, include=stats
adds element stats to the response. Possible values: stats
.
Headers
Authorization
string
Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
Content-Type
string
application/vnd.api+json
{
"data": [
{
"id": "24d98d49-8d7e-44f1-8ece-b75a5bcc2cdb",
"type": "elements",
"attributes": {
"offset": 9,
"certification": false,
"duration": 651,
"include_in_latest_results_feed": true,
"max_votes_per_user": 1,
"max_votes_per_option": 1,
"content_type": "prediction-custom",
"label": "Which came first, the chicken or the egg?",
"require_verified_user": false,
"reveal_results_mode": "never",
"revoked_at": null,
"revoked_at_iso": null,
"start_mode": "manual",
"state": "past",
"enmasse_id": 4132,
"correct_option": null,
"updated_at": 1574340219,
"updated_at_iso": "2019-11-21T12:43:39Z",
"duration_mode": "fixed",
"name": "Element",
"results_revealed_at_iso": null,
"answer_revealed_at_iso": null,
"custom_fields": [
{
"key": "text_during_quiz",
"values": {
"ab": null,
"en": "Make your decision now..."
}
},
{
"key": "text_after_answering",
"values": {
"all": "Thanks for answering"
}
},
{
"key": "text_after_quiz",
"values": {
"all": "Question is closed"
}
},
{
"key": "text_after_reveal",
"values": {
"all": "Question is revealed"
}
}
],
"question": {
"label": "Which came first, the chicken or the egg?",
"filter_keywords": [],
"fields": [
{
"key": "text",
"values": {
"ab": null,
"en": "Which came first, the chicken or the egg?"
}
},
{
"key": "image_url",
"values": {
"ab": null,
"en": null
}
}
],
"options": [
{
"label": "The chicken"
"filter_keywords": [],
"fields": [
{
"key": "text",
"values": {
"ab": null,
"en": "The chicken"
}
},
{
"key": "image_url",
"values": {
"ab": null,
"en": null
}
}
]
},
{
"label": "The egg",
"filter_keywords": [],
"fields": [
{
"key": "text",
"values": {
"ab": null,
"en": "The egg"
}
},
{
"key": "image_url",
"values": {
"ab": null,
"en": null
}
}
]
}
]
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/24d98d49-8d7e-44f1-8ece-b75a5bcc2cdb"
},
"relationships": {
"event": {
"data": {
"id": "cafc2ae8-2cd6-4664-bb20-e9e30a5f0e8d",
"type": "events"
}
},
"stats": {
"data": {
"id": "24d98d49-8d7e-44f1-8ece-b75a5bcc2cdb",
"type": "stats"
}
}
}
}
],
"included": [
{
"id": "24d98d49-8d7e-44f1-8ece-b75a5bcc2cdb",
"type": "stats",
"attributes": {
"aggregated": {
"results": [
{
"percentage": 0,
"votes": 0
},
{
"percentage": 100,
"votes": 1
}
],
"voters": 1,
"votes": 1
},
"results_are_final": false,
"sources": [
{
"results": [
{
"percentage": 0,
"votes": 0
},
{
"percentage": 100,
"votes": 1
}
],
"source": "regular",
"voters": 1,
"votes": 1
}
]
}
}
],
"links": {
"self": "https://environment.monterosa.cloud/api/v2/events/4c60ee2c-869d-4632-af3f-546bb1c1e535/elements"
}
}
{
"errors": [
{
"detail": "unexpected keys [results], only [stats] are allowed",
"source": {
"pointer": "/data/attributes/include"
}
}
]
}
Example
Filter elements by non_scheduled
state.
curl --request GET \
--globoff --url 'https://environment.monterosa.cloud/api/v2/events/6977197a-51b1-4579-8785-dcd0e266d6dd/elements?filter[state]=non_scheduled' \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json'
{
"data": [
{
"id": "ee05b935-0dbc-476c-9417-6075a7e2ec1d",
"type": "elements",
"attributes": {
"offset": 0,
"duration": 60,
"content_type": "rpoll-custom",
"start_mode": "manual",
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"custom_fields": [],
"label": "Question",
"question": {
"label": "Question",
"fields": [
{
"key": "text",
"values": {
"en": "Question"
}
}
],
"filter_keywords": [],
"options": [
{
"label": "Option #1",
"fields": [
{
"key": "text",
"values": {
"en": "Option #1"
}
}
],
"filter_keywords": []
},
{
"label": "Option #2",
"fields": [
{
"key": "text",
"values": {
"en": "Option #2"
}
}
],
"filter_keywords": []
}
]
},
"reveal_results_mode": "vote",
"require_verified_user": false,
"include_in_latest_results_feed": true,
"certification": false,
"enmasse_id": null,
"max_votes_per_user": 5,
"max_votes_per_option": 2,
"min_options_per_vote": 1,
"max_options_per_vote": 2,
"duration_mode": "fixed",
"name": "Element",
"results_revealed_at_iso": null
},
"relationships": {
"event": {
"data": {
"id": "cafc2ae8-2cd6-4664-bb20-e9e30a5f0e8d",
"type": "events"
}
},
"stats": {
"data": {
"id": "ee05b935-0dbc-476c-9417-6075a7e2ec1d",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/ee05b935-0dbc-476c-9417-6075a7e2ec1d"
}
}
],
"links": {
"self": "https://environment.monterosa.cloud/api/v2/events/6977197a-51b1-4579-8785-dcd0e266d6dd/elements"
}
}
Element attributes described in the Element Resource section.