Create Element
Create element within specified event.
Create Element
POST
https://environment.monterosa.cloud/api/v2/elements
Headers
Authorization
string
Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
Content-Type
string
application/vnd.api+json
Request Body
content_type
string
Element content type.
duration
integer
Element duration in seconds. Required for elements with duration.
start_mode
string
Start mode. Possible values: "manual", "timecode".
offset
integer
Element offset from event start in seconds. Required only for the "timecode" start mode.
action
string
Action "publish" is allowed only.
question
object
Question (with options) for poll-like elements.
correct_option
integer
Number of correct option. Required only for prediction and trivia.
reveal_results_mode
string
Set when the results will be revealed to the client. Only for poll-like elements. Possible values: "vote", "close", "event_end", "never", "manual".
require_verified_user
boolean
Sets mode when only verified user can vote.
include_in_latest_results_feed
boolean
Include element results in latest results feed.
certification
boolean
Enables votes certification for poll-like elements.
max_votes_per_user
string
Maximum number of votes per user.
max_votes_per_option
integer
Maximum number of votes a user can cast per option.
min_options_per_vote
integer
Minimum options count allowed to vote.
max_options_per_vote
integer
Maximum options count allowed to vote.
reveal_answer_mode
string
Reveal answer mode for quiz elements. Possible values: "auto", "manual".
reveal_answer_in
integer
Answer reveal delay in seconds in auto mode for quiz elements.
fade
integer
A number of seconds between user's vote and when this vote will be faded out.
custom_fields
array
List of an element's custom fields. Each field is updated separately and if present its content is rewritten completely.
reveal_answer_on_vote
boolean
Enables reveal answer on vote for quiz elements.
Check below for requests and responses for different types of elements.
{
"errors": [
{
"source": {
"pointer": "/data/attributes/duration"
},
"detail": "must be greater than or equal to 0"
}
]
}
Example
Create a Vote
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "6396746d-5b45-42b9-a364-35ad0cceffaa"
}
}
},
"attributes": {
"content_type": "rpoll-custom",
"start_mode": "manual",
"duration": 45,
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [],
"question": {
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
]
}
]
}
}
}
}
// Status: 201 Created
{
"data": {
"id": "c5ba869b-ad4f-4d01-a0b6-63b6bd7f93c0",
"type": "elements",
"attributes": {
"label": "Question Text",
"offset": 0,
"duration": 45,
"content_type": "rpoll-custom",
"start_mode": "manual",
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"reveal_results_mode": "vote",
"require_verified_user": false,
"include_in_latest_results_feed": false,
"certification": true,
"max_votes_per_user": 3,
"max_votes_per_option": 2,
"min_options_per_vote": 1,
"max_options_per_vote": 2,
"enmasse_id": null,
"duration_mode": "fixed",
"name": "Element",
"results_revealed_at_iso": null,
"custom_fields": [
{
"key": "text_during_poll",
"values": {
"en": "Make your decision now..."
}
},
{
"key": "text_after_poll",
"values": {
"en": "Poll closed"
}
},
{
"key": "text_after_answering",
"values": {
"en": "Thanks for answering"
}
}
],
"question": {
"label": "Question Text",
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": [],
"options": [
{
"label": "Option Text #1",
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": []
},
{
"label": "Option Text #2",
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": []
}
]
}
},
"relationships": {
"stats": {
"data": {
"id": "c5ba869b-ad4f-4d01-a0b6-63b6bd7f93c0",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/c5ba869b-ad4f-4d01-a0b6-63b6bd7f93c0"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "6396746d-5b45-42b9-a364-35ad0cceffaa"
}
}
},
"attributes": {
"content_type": "rpoll-custom",
"start_mode": "manual",
"duration": 45,
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [],
"question": {
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
]
}
]
}
}
}
}'
Vote element is created here, as specified by rpoll-custom
value for /data/attributes/content_type
property. This value is specific for each app and it has to match the value specified in your app spec.
The poll has a question and two options. The question and each of the options is made up of text and image fields. Duration is set to 45 seconds.
The vote is created in the event with id 6396746d-5b45-42b9-a364-35ad0cceffaa
as set by /data/relationships/event/data/id
.
Create a flexible Prediction
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "6b98f449-77f5-4261-93ca-36bcbce81c71"
}
}
},
"attributes": {
"content_type": "prediction-custom",
"start_mode": "manual",
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [],
"question": {
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
]
}
]
}
}
}
}
// Status: 201 Created
{
"data": {
"id": "529e4cde-9fa8-41b6-a62c-2b41d9abe49b",
"type": "elements",
"attributes": {
"offset": 0,
"duration": 0,
"content_type": "prediction-custom",
"start_mode": "manual",
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"correct_option": null,
"custom_fields": [
{
"key": "text_during_quiz",
"values": {
"en": "Make your decision now..."
}
},
{
"key": "text_after_answering",
"values": {
"en": "Thanks for answering"
}
},
{
"key": "text_after_quiz",
"values": {
"en": "Question is closed"
}
},
{
"key": "text_after_reveal",
"values": {
"en": "Question is revealed"
}
}
],
"label": "Question Text",
"question": {
"label": "Question Text",
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": [],
"options": [
{
"label": "Option Text #1",
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": []
},
{
"label": "Option Text #2",
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"filter_keywords": []
}
]
},
"reveal_results_mode": "vote",
"require_verified_user": false,
"include_in_latest_results_feed": false,
"certification": false,
"max_votes_per_user": 1,
"max_votes_per_option": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"enmasse_id": null
},
"relationships": {
"stats": {
"data": {
"id": "529e4cde-9fa8-41b6-a62c-2b41d9abe49b",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/529e4cde-9fa8-41b6-a62c-2b41d9abe49b"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "6b98f449-77f5-4261-93ca-36bcbce81c71"
}
}
},
"attributes": {
"content_type": "prediction-custom",
"start_mode": "manual",
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [],
"question": {
"fields": [
{
"key": "text",
"values": {
"en": "Question Text"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #1"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"en": "Option Text #2"
}
},
{
"key": "image_url",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
]
}
]
}
}
}
}'
Flexible prediction with a question with two options is created here.
Attribute "/data/attributes/content_type": "prediction-custom"
is used to create a flexible prediction. This value is specific for each app and it has to match the value specified in your app spec.
Create a Trivia Element
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "74e23f8d-8ed6-4185-b061-12e1be071859"
}
}
},
"attributes": {
"content_type": "trivia",
"duration": 600,
"start_mode": "manual",
"question": {
"fields": [
{
"key": "text",
"values": {
"all": "Which came first: the chicken or the egg?"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"all": "The chicken"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "The egg"
}
}
]
}
]
},
"reveal_answer_mode": "auto",
"reveal_answer_in": 15,
"reveal_answer_on_vote": true,
"correct_option": 2,
"custom_fields": []
}
}
}
// Status: 201 Created
{
"data": {
"id": "ff4c40c5-727a-41bc-a981-fa12f98e4a25",
"type": "elements",
"attributes": {
"offset": 0,
"content_type": "trivia-custom",
"start_mode": "manual",
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"duration": 600,
"custom_fields": [],
"label": "Which came first: the chicken or the egg?",
"question": {
"label": "Which came first: the chicken or the egg?",
"fields": [
{
"key": "text",
"values": {
"all": "Which came first: the chicken or the egg?"
}
}
],
"options": [
{
"label": "The chicken",
"fields": [
{
"key": "text",
"values": {
"all": "The chicken"
}
}
]
},
{
"label": "The egg",
"fields": [
{
"key": "text",
"values": {
"all": "The egg"
}
}
]
}
]
},
"reveal_results_mode": "never",
"require_verified_user": true,
"include_in_latest_results_feed": true,
"certification": false,
"enmasse_id": null,
"reveal_answer_mode": "auto",
"reveal_answer_in": 15,
"correct_option": 2,
"max_votes_per_user": 1,
"max_votes_per_option": 1
},
"relationships": {
"event": {
"data": {
"id": "74e23f8d-8ed6-4185-b061-12e1be071859",
"type": "events"
}
},
"stats": {
"data": {
"id": "ff4c40c5-727a-41bc-a981-fa12f98e4a25",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/ff4c40c5-727a-41bc-a981-fa12f98e4a25"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer td18FzQxQ8ZgCAc9oHpQis8WJqkEn5B9' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "74e23f8d-8ed6-4185-b061-12e1be071859"
}
}
},
"attributes": {
"content_type": "trivia-custom",
"duration": 600,
"start_mode": "manual",
"question": {
"fields": [
{
"key": "text",
"values": {
"all": "Which came first: the chicken or the egg?"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"all": "The chicken"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "The egg"
}
}
]
}
]
},
"reveal_answer_mode": "auto",
"reveal_answer_in": 15,
"correct_option": 2,
"custom_fields": []
}
}
}'
Trivia element is created here, with a question and two options. "correct_option" is provided with the second option value. And "reveal_answer_mode" is set to "auto". That means the correct option will be revealed automatically after 15 seconds from the element end as specified in the "reveal_answer_in" field.
Create a Multi vote Element
To enable multi-vote for an element, the element's spec must include multi_vote object.
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "5aaae08d-144c-4b5b-a872-283b30c8c679"
}
}
},
"attributes": {
"content_type": "multi-vote",
"duration": 600,
"start_mode": "manual",
"question": {
"fields": [
{
"key": "text",
"values": {
"all": "What kind of pet would you like to have?"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"all": "A dog"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A cat"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A hedgehog"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A turtle"
}
}
]
}
]
},
"max_votes_per_user": 5,
"max_votes_per_option": 4,
"min_options_per_vote": 2,
"max_options_per_vote": 3
}
}
}
// Status: 201 Created
{
"data": {
"id": "050f880e-32bc-4758-8eb4-5d496076ec35",
"type": "elements",
"attributes": {
"offset": 0,
"content_type": "multi-vote",
"start_mode": "manual",
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"duration": 600,
"custom_fields": [],
"label": "What kind of pet would you like to have?",
"question": {
"label": "What kind of pet would you like to have?",
"fields": [
{
"key": "text",
"values": {
"all": "What kind of pet would you like to have?"
}
}
],
"filter_keywords": [],
"options": [
{
"label": "A dog",
"fields": [
{
"key": "text",
"values": {
"all": "A dog"
}
}
],
"filter_keywords": []
},
{
"label": "A cat",
"fields": [
{
"key": "text",
"values": {
"all": "A cat"
}
}
],
"filter_keywords": []
},
{
"label": "A hedgehog",
"fields": [
{
"key": "text",
"values": {
"all": "A hedgehog"
}
}
],
"filter_keywords": []
},
{
"label": "A turtle",
"fields": [
{
"key": "text",
"values": {
"all": "A turtle"
}
}
],
"filter_keywords": []
}
]
},
"reveal_results_mode": "event_end",
"require_verified_user": false,
"include_in_latest_results_feed": true,
"certification": false,
"enmasse_id": null,
"max_votes_per_user": 5,
"max_votes_per_option": 4,
"min_options_per_vote": 2,
"max_options_per_vote": 3
},
"relationships": {
"event": {
"data": {
"id": "5aaae08d-144c-4b5b-a872-283b30c8c679",
"type": "events"
}
},
"stats": {
"data": {
"id": "050f880e-32bc-4758-8eb4-5d496076ec35",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/050f880e-32bc-4758-8eb4-5d496076ec35"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer td18FzQxQ8ZgCAc9oHpQis8WJqkEn5B9' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "5aaae08d-144c-4b5b-a872-283b30c8c679"
}
}
},
"attributes": {
"content_type": "multi-vote",
"duration": 600,
"start_mode": "manual",
"question": {
"fields": [
{
"key": "text",
"values": {
"all": "What kind of pet would you like to have?"
}
}
],
"options": [
{
"fields": [
{
"key": "text",
"values": {
"all": "A dog"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A cat"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A hedgehog"
}
}
]
},
{
"fields": [
{
"key": "text",
"values": {
"all": "A turtle"
}
}
]
}
]
},
"max_votes_per_user": 5,
"max_votes_per_option": 4,
"min_options_per_vote": 2,
"max_options_per_vote": 3
}
}
}'
Vote Element is created here, with enabled and configured multi-vote feature.
Create a Media Element
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "32a9c9f2-3316-474d-8af5-94a5128849f9"
}
}
},
"attributes": {
"content_type": "media",
"start_mode": "manual",
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [
{
"key": "media_text",
"values": {
"en": "Media Text"
}
},
{
"key": "media_image",
"values": {
"en": "https://example.com/image.jpg"
}
}
]
}
}
}
// Status: 201 Created
{
"data": {
"id": "77c53ff6-39f2-4264-9bbf-06d40190d341",
"type": "elements",
"attributes": {
"offset": 0,
"duration": 0,
"content_type": "media",
"start_mode": "manual",
"state": "nonscheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"custom_fields": [
{
"key": "media_text",
"values": {
"en": "Main Media"
}
},
{
"key": "media_image",
"values": {
"en": "https://example.com/image.jpg"
}
}
],
"label": "Main Media"
},
"relationships": {
"stats": {
"data": {
"id": "77c53ff6-39f2-4264-9bbf-06d40190d341",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/77c53ff6-39f2-4264-9bbf-06d40190d341"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "32a9c9f2-3316-474d-8af5-94a5128849f9"
}
}
},
"attributes": {
"content_type": "media",
"start_mode": "manual",
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"custom_fields": [
{
"key": "media_text",
"values": {
"en": "Media Text"
}
},
{
"key": "media_text",
"values": {
"en": "https://monterosa.co.uk/image.jpg"
}
}
]
}
}
}'
Media element is created here, as specified by media
value for /data/attributes/content_type
property. This value is specific for each app and it has to match the value specified in your elements spec.
This media element has two custom fields: media_text
and media_image
.
The media is created in the event with ID 32a9c9f2-3316-474d-8af5-94a5128849f9
as provided by /data/relationships/event/data/id
.
Create a Poll
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "b9f62458-ff1f-4fce-9e7f-31c430c3dedd"
}
}
},
"attributes": {
"content_type": "custom_poll",
"start_mode": "manual",
"offset": 0,
"duration": 300,
"certification": true,
"require_verified_user": false,
"reveal_results_mode": "event_end",
"include_in_latest_results_feed": true,
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"question": {
"filter_keywords": ["#first_question"],
"fields": [
{
"key": "text",
"values": {
"all": "Question 1"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/question.png"
}
}
],
"options": [
{
"filter_keywords": ["#option1", "option1-best"],
"fields": [
{
"key": "text",
"values": {
"en": "Option 1",
"pl": null
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img1.png"
}
}
]
},
{
"filter_keywords": ["#option2"],
"fields": [
{
"key": "text",
"values": {
"en": null,
"pl": "Option 2"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img2.png"
}
}
]
}
]
},
"custom_fields": [
{
"key": "public",
"values": {
"all": false
}
}
]
}
}
}
// Status: 201 Created
{
"data": {
"id": "f0208d7a-a511-4c80-97fc-e33cae6db301",
"type": "elements",
"attributes": {
"content_type": "custom_poll",
"start_mode": "manual",
"offset": 0,
"duration": 300,
"certification": true,
"require_verified_user": false,
"reveal_results_mode": "event_end",
"include_in_latest_results_feed": true,
"state": "non_scheduled",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"max_votes_per_user": 1,
"max_votes_per_option": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"label" : "Question 1",
"enmasse_id": null,
"question": {
"filter_keywords": ["#first_question"],
"fields": [
{
"key": "text",
"values": {
"all": "Question 1"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/question.png"
}
}
],
"label" : "Question 1",
"options": [
{
"filter_keywords": ["#option1", "option1-best"],
"fields": [
{
"key": "text",
"values": {
"en": "Option 1",
"pl": null
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img1.png"
}
}
],
"label" : "Option 1"
},
{
"filter_keywords": ["#option2"],
"fields": [
{
"key": "text",
"values": {
"en": null,
"pl": "Option 2"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img2.png"
}
}
],
"label" : "Option 2"
}
]
},
"custom_fields": [
{
"key": "public",
"values": {
"all": false
}
}
]
},
"relationships": {
"stats": {
"data": {
"id": "f0208d7a-a511-4c80-97fc-e33cae6db301",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/f0208d7a-a511-4c80-97fc-e33cae6db301"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "b9f62458-ff1f-4fce-9e7f-31c430c3dedd"
}
}
},
"attributes": {
"content_type": "custom_poll",
"start_mode": "manual",
"offset": 0,
"duration": 300,
"certification": true,
"require_verified_user": false,
"reveal_results_mode": "event_end",
"include_in_latest_results_feed": true,
"max_votes_per_user": 1,
"min_options_per_vote": 1,
"max_options_per_vote": 1,
"question": {
"filter_keywords": ["#first_question"],
"fields": [
{
"key": "text",
"values": {
"all": "Question 1"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/question.png"
}
}
],
"options": [
{
"filter_keywords": ["#option1", "option1-best"],
"fields": [
{
"key": "text",
"values": {
"all": "Option 1"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img1.png"
}
}
]
},
{
"filter_keywords": ["#option2"],
"fields": [
{
"key": "text",
"values": {
"en": null,
"pl": "Option 2"
}
},
{
"key": "image_url",
"values": {
"all": "//example.com/img2.png"
}
}
]
}
]
},
"custom_fields": [
{
"key": "public",
"values": {
"all": false
}
}
]
}
}
}'
Create a data element
// POST /api/v2/elements
// Host: environment.monterosa.cloud
// Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb
// Content-Type: application/vnd.api+json
{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "b9f62458-ff1f-4fce-9e7f-31c430c3dedd"
}
}
},
"attributes": {
"content_type": "article",
"offset": 120,
"start_mode": "timecode",
"custom_fields": [
{
"key": "title",
"values": {
"en": "Article Title"
}
},
{
"key": "author",
"values": {
"all": "John Smith"
}
},
{
"key": "public",
"values": {
"all": false
}
},
{
"key": "content_items",
"items": [
[
{
"key": "paragraph_type",
"values": {
"all": "paragraph"
}
},
{
"key": "paragraph_text",
"values": {
"all": "Lorem ipsum dolor sit amet"
}
}
],
[
{
"key": "paragraph_type",
"values": {
"all": "image"
}
},
{
"key": "paragraph_image",
"values": {
"all": "https://example.com/articles/par1.jpg"
}
}
]
]
}
]
}
}
}
// Status: 201 Created
{
"data": {
"id": "b81b4aaf-d982-4d3e-a730-4e79b3a598ae",
"type": "elements",
"attributes": {
"content_type": "article",
"duration": 0,
"offset": 120,
"start_mode": "timecode",
"state": "future",
"updated_at": null,
"updated_at_iso": null,
"revoked_at": null,
"revoked_at_iso": null,
"label": "Article Title"
"custom_fields": [
{
"key": "title",
"values": {
"en": "Article Title",
"by": null
}
},
{
"key": "author",
"values": {
"all": "John Smith"
}
},
{
"key": "public",
"values": {
"all": false
}
},
{
"key": "content_items",
"items": [
[
{
"key": "paragraph_type",
"values": {
"all": "paragraph"
}
},
{
"key": "paragraph_text",
"values": {
"all": "Lorem ipsum dolor sit amet"
}
}
],
[
{
"key": "paragraph_type",
"values": {
"all": "image"
}
},
{
"key": "paragraph_image",
"values": {
"all": "https://example.com/articles/par1.jpg"
}
}
]
]
}
]
},
"relationships": {
"stats": {
"data": {
"id": "b81b4aaf-d982-4d3e-a730-4e79b3a598ae",
"type": "stats"
}
}
},
"links": {
"self": "https://environment.monterosa.cloud/api/v2/elements/b81b4aaf-d982-4d3e-a730-4e79b3a598ae"
}
}
}
curl --request POST \
--url https://environment.monterosa.cloud/api/v2/elements \
--header 'Authorization: Bearer JmsmU5gZb6xNVUgQGoKcQLvQjRhKAUSb' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data": {
"type": "elements",
"relationships": {
"event": {
"data": {
"type": "events",
"id": "b9f62458-ff1f-4fce-9e7f-31c430c3dedd"
}
}
},
"attributes": {
"content_type": "article",
"offset": 120,
"start_mode": "timecode",
"custom_fields": [
{
"key": "title",
"values": {
"en": "Article Title"
}
},
{
"key": "author",
"values": {
"all": "John Smith"
}
},
{
"key": "public",
"values": {
"all": false
}
},
{
"key": "content_items",
"items": [
[
{
"key": "paragraph_type",
"values": {
"all": "paragraph"
}
},
{
"key": "paragraph_text",
"values": {
"all": "Lorem ipsum dolor sit amet"
}
}
],
[
{
"key": "paragraph_type",
"values": {
"all": "image"
}
},
{
"key": "paragraph_image",
"values": {
"all": "https://example.com/articles/par1.jpg"
}
}
]
]
}
]
}
}
}'
Was this helpful?