Title: REST API returnig empty Instagram data-shortcode attribute
Last modified: May 1, 2021

---

# REST API returnig empty Instagram data-shortcode attribute

 *  Resolved [Junior Miranda](https://wordpress.org/support/users/jmjunior/)
 * (@jmjunior)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/api-returnig-empty-data-shortcode-attribute/)
 * Hello folks.
 * My REST API is returning the Instagram `data-shortcode` attribute empty. Bellow
   follows the code of the post content rendering:
 *     ```
       private function get_the_content()
           {
               ob_start();
               the_content();
               $content = ob_get_clean();
   
               $sanitizers = amp_get_content_sanitizers();
   
               $embeds = apply_filters('amp_content_embed_handlers', array(
                   'AMP_Instagram_Embed_Handler' => array(),
                   'AMP_Twitter_Embed_Handler' => array(),
                   'AMP_Facebook_Embed_Handler' => array(),
               ));
   
               $amp_content = new \AMP_Content($content, $embeds, $sanitizers);
   
               $html = $amp_content->get_amp_content();
   
               // more links
               $more = new MoreLinks();
   
               $handler = new ContentHandler($html);
               $handler->insertBefore($more->render(), 0);
   
               return $handler->html();
           }
       ```
   
 * Apparently, the problem is related to Class `AMP_Instagram_Embed_Handler` `$node-
   >getAttribute( 'data-instgrm-permalink' )` property, that is returning empty.
   If I change it to any string, like `'https://www.instagram.com/p/CONSk9aHq7y/'`
   the API get the `data-shortcode` attribute value as expected.
 * Somebody knows what could be causing this issue, and how to avoi it on my code?
 * Thanks in advance.
    -  This topic was modified 5 years, 1 month ago by [Junior Miranda](https://wordpress.org/support/users/jmjunior/).
    -  This topic was modified 5 years, 1 month ago by [Junior Miranda](https://wordpress.org/support/users/jmjunior/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/api-returnig-empty-data-shortcode-attribute/#post-14388649)
 * Resolving as duplicate of [GitHub issue](https://github.com/ampproject/amp-wp/issues/6169).

Viewing 1 replies (of 1 total)

The topic ‘REST API returnig empty Instagram data-shortcode attribute’ is closed
to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/api-returnig-empty-data-shortcode-attribute/#post-14388649)
 * Status: resolved