Data Field Specification of the Participations Model Follow
This specification applies to both the REST API that works with the Participation model and the New Participation Webhook.
The Data field of the Participation model is responsible for publishing the specific content of a particular participation dynamic. That is, if the user completes a participation in a Survey, the data field will include the survey responses. If the user participates in a photo contest, the data field will include the uploaded photo.
The participation dynamic is defined by the Type field of the Participation model.
The Data field always has the same structure, and it is always an array of these 3 fields:
- ref: String
- title: String
- value: Array of Strings
These 3 fields depend on the type of participation. Currently, content is only returned in the data field for the following participation types:
- Type 2: Questionnaire-type participation, including knowledge quizzes, surveys, personality tests, pools, and product recommenders
- Type 7: Photo or video contest participation, including the URL and description of the content uploaded by the user in the contest.
- Type 18: Form-type participation, which includes the information entered by the user in the form
- Type 21: Photofun or Scenes-type participation, which includes the URL of the photo created by the user in the contest.
For the rest of the participation types, the API will return an empty array.
Below is the specification and an example of the data field for each of the supported participation types:
Type 2: Questionnaire-type participation
Each element of the data array corresponds to a question from the questionnaire. For each question:
- ref: Unique numeric identifier for the question
- title: Title of the question
- value: Array containing the answer or answers to the question. In the case of a multi-response question, each element of the array corresponds to an answer.
Example of a Participation object with survey responses:
{
"id": "687677717",
"promotion_id": "956595",
"stage_id": "87130",
"user_id": "13486351",
"created": "2023-05-29T13:20:28+00:00",
"ip": "176.80.52.106",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
"points": null,
"data": [
{
"ref": 186357,
"title": "<h1>Which is your favorite literary genre?</h1>",
"values": ["Adventure"]
},
{
"ref": 186358,
"title": "<h1>When do you usually read?</h1>",
"values": ["At night"]
}
]
}
Type 7: Photo or Video Contest Participation
Each element of the data
field array corresponds to a type of media content uploaded by a user. A user in a participation can upload multiple content types in different formats. For each type of media:
- ref: Type of media uploaded by a user, which can be: image, video, YouTube, URL, PDF
- title: Textual description or caption of the media content. It is the optional text that the user may have uploaded related to the photo or video.
- value: URL to the media content uploaded by the user (Note that this is an array with only one value)
Example of a Participation object with responses from a media upload contest:
{
"id": "696926967",
"promotion_id": "967205",
"stage_id": "109923",
"user_id": "16192596",
"created": "2023-10-11T06:38:32+00:00",
"ip": null,
"user_agent": null,
"points": null,
"data": [
{
"ref": "video",
"values": ["https://gsewl.cstmapp.com//media/originals/6526430bba4c8.mp4"],
"title": "Palacio Real"
},
{
"ref": "youtube",
"values": ["https://www.youtube.com/embed/-AiekHYqEvw"],
"title": "Zurich, Switzerland Hot Summer Walk 2023"
},
{
"ref": "image",
"values": ["https://storage.googleapis.com/gsewl/05/967205/media/normal/652641c82f9fd.jpeg"
"title": "The Trevi Fountain, with a nearly 40-meter facade, is one of the largest monumental Baroque fountains in Rome"
}
]
}
Type 18: Form-type Participation
Each element in the data array corresponds to a form field. For each field:
- ref: Unique numeric identifier for the field
- title: Title of the field
- value: Array containing the user input. For fields with multiple answers, each element of the array corresponds to one response.
Example of a Participation object of form type:
{
"id": "726174927",
"promotion_id": "985270",
"stage_id": "201252",
"user_id": "3",
"created": "2024-10-03T11:32:51+00:00",
"ip": "35.187.16.97",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
"points": null,
"data": [
{
"ref": "newsletter",
"title": "Subscribe to newsletter",
"values": [true]
},
{
"ref": "store",
"title": "Select your preferred store",
"values": ["Store 2"]
},
{
"ref": "birthday",
"title": "Introduce your birthday",
"values": ["1991-06-05"]
},
{
"ref": "time",
"title": "Your preferred time",
"values": ["Afternoon"]
},
{
"ref": "contact",
"title": "Preferred contact method",
"values": ["Email"]
}
]
}
Type 21: Photofun or Scenes Contest Participation
The Data field will consist of a single element, as the user can only create one image per participation. The definition is:
- ref: image
- title: empty.
- value: URL to the image generated by the user (Note: it is an array with a single value)
Example of a Photofun or Scenes Participation object:
{
"id": "718379376",
"promotion_id": "980839",
"stage_id": "177215",
"user_id": "36",
"created": "2024-07-03T07:08:45+00:00",
"ip": "81.45.47.19",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
"points": null,
"data": [
{
"ref": "image",
"values": ["https://storage.googleapis.com/gsewl/39/980839/media/normal/6684f8f8ab1d6.jpg"],
"title": ""
}
]
}
Comments
0 comments
Article is closed for comments.