Title: oembed via REST API
Last modified: June 2, 2021

---

# oembed via REST API

 *  [WordHerd](https://wordpress.org/support/users/khadlock/)
 * (@khadlock)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/)
 * Hello,
 * Our team is using the REST API to auto-generate posts with videos (using wp:embed
   block) and prior to the updates with WordPress embed code our videos loaded. 
   Since this update, we are now experiencing an issue with oembed not being triggered
   during post creation via the REST API and therefore requiring an additional step
   of republishing the post.
 * Does ayone have any suggestions on how to ensure that oembed occurs for videos(
   using wp:embed block) in posts that are being created via the REST API.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14516675)
 * The API shouldn’t have anything to do with oEmbed. The oEmbed process occurs 
   when the post is served, not when or how it’s created. As far as the saved post
   goes, the embed is simply a bare URL in post content. When the post is served
   WP seeks out bare URLs and checks to see if any are related to an oEmbed server.
   If so, it attempts to fetch the related HTML which replaces the bare URL.
 * If your videos aren’t loading in an embed, the problem is more likely with the
   oEmbed server at the URL’s source. Or the oEmbed fetch process on your server
   has been corrupted by some theme or plugin conflict.
 *  Thread Starter [WordHerd](https://wordpress.org/support/users/khadlock/)
 * (@khadlock)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14517142)
 * Hi [@bcworkz](https://wordpress.org/support/users/bcworkz/) –
 * Thank you for responding. The oEmbed process works within Gutenberg/Block Editor
   once viewing the edit screen, as it then saves the oEmbed post meta and the associated
   oEmbed post_type based on the oEmbed server response. However, if we create a
   post with video as a block via the REST API and then view that post in the front
   end without editing the post, the oEmbed process never occurs. We are processing
   over 1k posts with videos and cannot afford to edit each post manually to trigger
   the oEmbed process.
 * Here is an example of a post we are creating via the REST API:
 * REST API endpoint:
    `/wp-json/wp/v2/posts`
 * Code
 *     ```
       {
       	"content": "<!-- wp:embed {\"url\":\"https://www.youtube.com/embed/t1xaI36UXGY\",\"type\":\"rich\",\"providerNameSlug\":\"embed-handler\",\"responsive\":true,\"className\":\"is-provider-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"} --><figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">https://www.youtube.com/embed/t1xaI36UXGY</div></figure><!-- /wp:embed --><!-- wp:paragraph --><p>This is a paragraph</p><!-- /wp:paragraph -->",
         "slug": "api-video-test",
         "status": "publish",
         "title": "API Video Test",
         "type": "post"
       }
       ```
   
    -  This reply was modified 5 years, 2 months ago by [WordHerd](https://wordpress.org/support/users/khadlock/).
      Reason: clarification
    -  This reply was modified 5 years, 2 months ago by [WordHerd](https://wordpress.org/support/users/khadlock/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14520923)
 * Saving using wp-cli? That’s not my forte, sorry. If you tag this topic “wp-cli”
   it’ll help get the attention of wp-cli support volunteers.
 *  Thread Starter [WordHerd](https://wordpress.org/support/users/khadlock/)
 * (@khadlock)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14520992)
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/) Actually, it is via 
   the WP REST API, not wp-cli. How would you recommend tagging in that case?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14523410)
 * Except for wp-cli, tagging isn’t going to help garner more specific support, 
   they’re more for others seeking help with similar problems.
 * The block editor saves via the API and its embeds don’t seem to have any trouble.
   Could there be something missing or aberrant in what you save? Compare your saved
   data with that from the block editor.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘oembed via REST API’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/oembed-via-rest-api/#post-14523410)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
