How to resolve the problem with response structure of Instagram interaction of type Image?


#1

Hi,
I have set up an Instagram managed source.
While pulling the interactions through API, from managed source I noticed that there are different structure/schema followed for interaction type “image” than of type “like_count” or “comment_count”.
since all the interactions are in an array of Json stream, so I am not able to de-serialize it. Can you please suggest?


#2

Most of our data sources will have a number of different schemas depending on the value of the interaction.subtype field. Instagram interactions will have one of three types of schema:

  • image and video interactions have a “Post” schema
  • comment interactions have a “Comment” schema
  • like_count and comment_count interactions have an “Engagements” schema

It sounds like you’ve set up your Push Delivery option to deliver an array of JSON objects (the json_array or json_meta output format). Depending on the Push Delivery connector you choose, you can also use the json_new_line format to deliver newline separated JSON objects.


#3

How can I set up a filter to a managed source so that I could get filtered data through Rest API call?


#4

We actually provide a full module on this topic in our free online training courses. You can sign up here: datasift.com/platform/services/training. We also provide a Step-by-step API guide for Managed Sources which I’d recommend taking a look at.

In order to set up a Managed Source, and consume data, your workflow should look something like this:

  1. Create the Managed Source via the UI or API
  2. Using either the Managed Source ID, or just filtering more generally, create a CSDL filter to consume data from that source. For example, source.id == "ed291360e6a9bd49927848358bb8c1ffb3" AND interaction.content ANY "coffee" will match any interactions generated by the Managed Source with the ID ed291360e6a9bd49927848358bb8c1ffb3, and which contain the word “coffee” within the interaction.content field.
  3. Take the CSDL hash you received from compiling that CSDL filter, and subscribe to it in a Push Subscription. Most Push Connectors work by regularly pushing data to a destination of your choice. You can also use the Pull connector if you’d like to consume the data in a RESTful way; issuing API requests to pull back data when you’re ready for it.