Pull feedback data
Query API is a mechanism for extracting data from Medallia Experience Cloud. Use Query API to make basic queries and extract survey responses.
To pull feedback data, request the feedback
node. The feedback object represents data records where the e_status
value is COMPLETED, which means that surveys are complete and survey-response data is available for extraction.
feedback
operations, when you are filtering by a specific timeperiod, run your query several hours after the period ends to ensure completeness. 10 hours is usually a good delay.For instance, ask the feedback
node to return each record's ID, and the total count of records that matched.
Example: Data query
query getSurveyTakerContactDetails(
$filter: Filter
) {
feedback(
filter: $filter
) {
nodes {
id
email: fieldData(fieldId: "e_email") {
values
}
name: fieldData(fieldId: "a_fullname") {
values
}
}
totalCount
pageInfo {
hasNextPage
endCursor
}
}
}
Send variables in a separate post argument apart from the query definition: The $filter
parameter can be used to limit the search to a subset of records.
Example: Variables
{
"filter": null
}
Sample response
{
"data": {
"feedback": {
"nodes": [
{
"id": "12827260",
"email": { "values": ["john@example.medallia.com"] },
"name": { "values": ["John Patterson"] }
},
{
"id": "12827258"
"email": { "values": ["mary@example.medallia.com"] },
"name": { "values": ["Mary Jackson"] }
},
...
],
"totalCount": 4831376,
"pageInfo": {
"hasNextPage": true,
"endCursor": "xWSJSCIGh9+8WBydu4cOW5xdK9Q"
}
}
}
}
The feedback node also returns the pageInfo
needed to make the next query in the pagination. For more details about pagination, see Pagination.
Filtering is composed of an aggregate operation (and, or, not, etc.) with a nesting of other aggregate operations or field-specific operations. For more details about filters, see Filter and sort data. The query below is an example of a more complex query structure to extract survey-response data from specific fields mapped in the variables argument.
Example: Data query
query getFeedback(
$extractionStartDate: String
$extractionEndDate: String
$offset: ID
$pageSize: Int!
$metadataFields: [ID!]!
$questionFields: [ID!]!
) {
feedback(
# Filter on a specific survey record for testing
ids: "136689"
filter: {
and: [
{ fieldIds: "e_responsedate", gte: $extractionStartDate }
{ fieldIds: "e_responsedate", lte: $extractionEndDate }
]
}
after: $offset
first: $pageSize
orderBy: { fieldId: "e_responsedate", direction: DESC }
) {
pageInfo {
endCursor
hasNextPage
}
totalCount
nodes {
# Extract metadata information for the fiels provided in the metadataFields variable
metaData: fieldDataList(
# Hide 'null' values
filterUnanswered: true
fieldIds: $metadataFields
) {
# Get the id and name of the field
field {
id
name
}
# Use the extendFieldData fragment to get different data for different types of fields
...extendFieldData
}
# Do the same for all question fields
questionData: fieldDataList(
filterUnanswered: true
fieldIds: $questionFields
) {
field {
id
name
}
...extendFieldData
}
}
}
}
# This is the fragment to get different data for differnet types of fields
fragment extendFieldData on FieldData {
... on EnumFieldData {
options {
id
name
}
}
... on StringFieldData {
values
}
... on CommentFieldData {
values
topics: ruleTopicTaggingsPage {
nodes {
topic {
id
name
}
regions {
startIndex
endIndex
}
}
}
themes: dataTopicTaggingsPage {
nodes {
topic {
id
name
}
regions {
startIndex
endIndex
}
}
}
sentiment: sentimentTaggingsPage {
nodes {
sentiment
regions {
startIndex
endIndex
}
}
}
}
... on IntFieldData {
values
}
... on DateFieldData {
values
}
... on UnitFieldData {
units {
identifier
name
unitGroups {
parent {
name
}
name
}
}
}
}
Example: Variables
{
"extractionStartDate":"2021-04-01",
"extractionEndDate":"2021-04-23",
"offset":0,
"pageSize":100,
"metadataFields": [
"a_surveyid",
"e_responsedate",
"e_bp_language_enum",
"e_bp_lottery_yn",
"e_lidl_bp_country_code_enum",
"e_unitid"
],
"questionFields": [
"q_lidl_what_did_you_like_cmt",
"q_bp_availability_backshop_yn",
"q_bp_availability_food_yn",
"q_bp_availability_nonfood_yn",
"q_bp_availability_o_and_g_yn",
"q_bp_availability_sausage_sb_yn",
"q_bp_availability_tiko_yn",
"q_bp_osat_yn",
"q_bp_total_goods_availabilty_yn",
"q_bp_osat_freshness_backshop_yn",
"q_bp_osat_freshness_meat_gefl_yn",
"q_bp_osat_freshness_mopro_gek_fk_yn",
"q_bp_osat_freshness_o_g_yn",
"q_bp_osat_freshness_plants_yn",
"q_bp_osat_freshness_sausage_sb_yn",
"q_bp_osat_freshness_service_counters_yn",
"q_bp_total_fresh_goods_yn",
"q_bp_cleanliness_order_overall_yn",
"q_bp_osat_cleanliness_backshop_yn",
"q_bp_osat_cleanliness_ekw_yn",
"q_bp_osat_cleanliness_entrance_area_yn",
"q_bp_osat_cleanliness_gefl_fl_fi_sb_yn",
"q_bp_osat_cleanliness_o_g_yn",
"q_bp_osat_cleanliness_order_customer_toilet_yn",
"q_bp_osat_cleanliness_order_mopro_gek_fk_yn",
"q_bp_osat_cleanliness_order_nonfood_yn",
"q_bp_osat_cleanliness_order_tiko_yn",
"q_bp_osat_cleanliness_orderly_food_yn",
"q_bp_osat_cleanliness_outdoor_area_yn",
"q_bp_osat_cleanliness_sb_sausage_yn",
"q_bp_osat_cleanliness_service_counters_yn",
"q_bp_friendliness_staff_yn",
"q_bp_cusomter_service_yn",
"q_bp_availability_staff_yn",
"q_bp_helpfulness_staff_yn",
"q_bp_processing_counters_total_enum",
"q_bp_processing_cash_register_total_yn",
"q_bp_waiting_time_checkout_yn",
"q_bp_correct_receipt_yn",
"q_bp_total_snack_enum",
"q_bp_availability_food_drinks_yn",
"q_bp_cleanliness_order_snack_yn",
"q_bp_recommendation_scale",
"q_bp_number_of_people_enum",
"q_bp_contact_email",
"q_bp_contact_first_name_cmt",
"q_bp_contact_kdc_enum",
"q_bp_contact_phone_cmt",
"q_bp_contact_process_text_cmt",
"q_bp_contact_salutation_enum",
"q_bp_contact_surname_cmt",
"q_bp_contact_type_enum",
"q_bp_how_did_you_hear_about_us_enum",
"q_bp_cz_k_card_user_enum",
"q_bp_cz_k_card_store_enum",
"q_bp_cz_k_card_digital_enum",
"q_bp_cz_k_card_digital_pro_yn",
"q_bp_cz_no_k_card_enum",
"q_bp_cz_no_k_card_reason_enum"
]
}
Q-fields, or Feedback fields, are the building blocks of reports and surveys in that they collect information provided by individuals, including the responses or answers to questions, and responses collected automatically either through observation, scraping, or import.
Ad Hoc survey data
For feedback
and invitations
data, use includeAdHoc:true|false
to include Ad Hoc survey data.
programs
and programRecordSchemas
nodes.Example: do not include Ad Hoc data
query myQuery {
rateLimit {
cost
}
feedback(
orderBy: { fieldId: "e_responsedate", direction: ASC }
first: 3
after: null
includeAdHoc: false
) {
pageInfo {
endCursor
hasNextPage
}
totalCount
nodes {
a_surveyid: fieldData(fieldId: "a_surveyid") {values}
e_accepteddate: fieldData(fieldId: "e_accepteddate") {values}
e_email: fieldData(fieldId: "e_email") {values}
e_responsedate: fieldData(fieldId: "e_responsedate") {values}
}
}
}
Example response
{
"data": {
"rateLimit": {
"cost": 1
},
"feedback": {
"pageInfo": {
"endCursor": "3",
"hasNextPage": true
},
"totalCount": 150191,
"nodes": [
{
"a_surveyid": {
"values": [
"2555503"
]
},
"e_accepteddate": {
"values": [
"2020-09-10 06:52:57"
]
},
"e_email": {
"values": [
"kmarshall112@example.com"
]
},
"e_responsedate": {
"values": [
"2018-01-01 00:00:00"
]
}
},
{
"a_surveyid": {
"values": [
"2554878"
]
},
"e_accepteddate": {
"values": [
"2020-09-10 06:52:57"
]
},
"e_email": {
"values": [
"rblack473@example.com"
]
},
"e_responsedate": {
"values": [
"2018-01-01 00:00:00"
]
}
},
{
"a_surveyid": {
"values": [
"2553762"
]
},
"e_accepteddate": {
"values": [
"2020-09-10 06:52:57"
]
},
"e_email": {
"values": [
"bperkins66@example.com"
]
},
"e_responsedate": {
"values": [
"2018-01-01 00:00:00"
]
}
}
]
}
},
"errors": null,
"_links": null,
"_allowed": [
"POST",
"GET"
]
}