Does Pimcore provide possibility to export Hotspots and Markers additional data in DataHub GraphQL?

182 views Asked by At

Asset Hotspots have 'add Data' in context menu. We can add related objects / fileds / documents / etc there.

enter image description here

How to export this data in GraphQL? I see only '__typename' property.

Sample query:

{
  getCategoryListing(defaultLanguage: "en") {
    totalCount
    edges {
      node {
        categoryimage {
          image {
            fullpath
          }
           hotspots {
            name
            top
            height
            left
            width            
            data {
              __typename
            }
          }
          marker {
            name
            top
            left
            data {
              __typename
            }
          }
         
        }
      }
    }
  }
}
1

There are 1 answers

0
Eugene Kaurov On BEST ANSWER

Yes, this functionality is provided by GraphQL itself.

  1. Check that you granted reading rights to object class that you are trying to access otherwise you will see 'object: null'
  2. learch which object types you get using __typename
  3. When you know the type name and have access to that object, just get its data

Sample:

... on property_text {
                type
                name
                text
              }

or

... on object_product {
                        sku
                      }

See the documentation here: https://pimcore.com/docs/data-hub/current/GraphQL/Query/Query_Samples/Sample_Element_Properties.html

Sample query to get additional data from Pimcore Hotspots and Markers on Hotspotimage:

{
  getCategoryListing(defaultLanguage: "en") {
    totalCount
    edges {
      node {
        id
        categoryimage {
          image {
            fullpath
          }
          hotspots {
            name
            top
            height
            left
            width
            data {
              __typename
              ... on property_text {
                type
                name
                text
              }
              ... on property_object {
                type
                name
                object {
                  __typename
                  ... on object_product {
                    sku
                  }
                  ... on element {
                    __typename
                  }
                }
              }
            }
          }
          marker {
            name
            top
            left
            data {
              __typename
              ... on property_text {
                type
                name
                text
              }
              ... on property_object {
                type
                name
                object {
                  __typename
                  ... on object_product {
                    sku
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}