Retrieve Media by Instagram ID

Get information about a media object owned by the authorized Instagram user.

This is the how the Pic Puller Instagram Image Browser field type would integrate into Craft templates. Instead of passing in a predefined media_id as this example does, you would use the value generated by the Image Browser. 

Note: This code example is for Pic Puller for Craft 2. If you're using Craft 3, the only difference is "picpuller" changes to "picPuller". The full Pic Puller for Craft 3 can be found here.

Documentation for this code example: Media by ID

The code block below is generating the section that follows it.

{% for instagramdata in{'use_stale_cache' : TRUE, 'user_id' : 1, 'media_id': '1209557797210819201_1500897'}) %}
  {% if loop.first %}
    <p>Status: {{ instagramdata.status }}</p>
    <p>Error Type: {{ instagramdata.error_type }}</p>
    <p>Error Message: {{ instagramdata.error_message }}</p>
  {% endif %}
  {% if instagramdata.status == 'true' %}
    <p>username: {{ instagramdata.username }}</p>
    <p>full_name: {{ instagramdata.full_name }}</p>
    <p><img src="{{instagramdata.low_resolution}}" alt='{{instagramdata.caption}}'></p>
    <p><em>Caption</em>: {{instagramdata.caption}}</p>
   {% if instagramdata.caption is not empty %}
        <p><em>Caption only: </em>{{ instagramdata.caption_only }}</p>
        <p><em>Tags ({{ instagramdata.tags|length }} in total): </em>
        {% for zeroBasedCounter, tag in instagramdata.tags %}
            <span>{{ tag }}</span>{% if zeroBasedCounter+1 < instagramdata.tags|length %}, {% endif %}
        {% endfor %}
    {% endif %}
    <p>created_time: {{ instagramdata.created_time }}</p>
  {% else %}
    <p>Error Type: {{ instagramdata.error_type }}</p>
    <p>Error Message: {{ instagramdata.error_message }}</p>
  {% endif %}
{% endfor %}
string(162) "400 [reason phrase] Bad Request [url]"