Query fragments

Query fragments are reusable GraphQL units that construct sets of fields that can be included in queries without repeating the field list. Fragments are especially useful for complex queries that need to reuse part of the query — to extend fieldData — in different nodes in the graph.

Note: For general discussion of query fragments, see Query Fragments.

When you combine fieldData with the "… on" inline fragment operator, you extend the field data and get more specific data. Because Medallia Experience Cloud data type can have their own schemas, use inline fragments to explore the graph on each dataType.

query getData{
  feedback(
    filter:{fieldIds:["e_responsedate"], gt:"2016-02-01"},  # filter object. In this 
                                                            # object complex filter can 
                                                            # be modeled
    after:null,      # cursor as starting point for the page
    first: 2         # page size
  ){
    pageInfo{
      endCursor      # this should be used as "after" paramenter for next page
      hasNextPage    # tell the query has more pages that could be retrieved
    }
    totalCount       # number of records that matched the filter
    rateLimit{
       cost          # query cost
    }
    nodes{           # object with data
        e_responsedate:       fieldData(fieldId:"e_responsedate"){ ... extendFieldData } # DATETIME
        k_bp_name_pretty_txt: fieldData(fieldId:"a_fullname"){ ... extendFieldData }     # STRING
        unit:                 fieldData(fieldId:"e_unitid"){ ... extendFieldData }       # UNIT
      }
    }
}
fragment extendFieldData on FieldData{
    ... on EnumFieldData{
            options{name}
          }
    ... on StringFieldData{values}   # a_fullname will use this
    ... on IntFieldData{values}
    ... on DateFieldData{values}     # e_responsedate will use this
    ... on UnitFieldData{            # e_unitid will use this
      units{name}}
}