Skip to content

How to correctly post videos programmatically (set “Embed Video” as source type) #107

@Sopuru

Description

@Sopuru

I’m trying to create a video post programmatically via the REST API (Python script) — specifically using the MAS Videos post type (video).
The goal is to make sure the video is registered exactly the same way as when I manually add a video via the WordPress admin interface — i.e., with:

Video Source: set to “Embed Video”

Video Embed Content: populated with the YouTube <iframe> embed HTML

Here’s what I’m doing right now:
`post_data = {
"title": title,
"content": content,
"status": "publish",
"video_cat": [category_id],
"meta": {
# Set the video type/source to 'embed'
VIDEO_TYPE_KEY: VIDEO_TYPE_VALUE,

    # Set the actual IFRAME embed code
    EMBED_CONTENT_KEY: embed_iframe,

    # Optional: Clear the direct URL field 
    # (assuming it's used when "Video File" or "External URL" is chosen)
    "_video_url": ""
}

}
`
When posting this through /wp-json/wp/v2/video, the video is created — but it doesn’t show as an embedded video on the site.
Instead, it seems that the “video type” (or “Video Choice” dropdown in the admin panel) is not being correctly set.

What I Need Clarified

Could you please confirm:

What are the correct meta keys used internally by MAS Videos to store:

the selected video source (e.g., Embed Video, Self Hosted, External URL, etc.)

the actual embed iframe content (for “Embed Video”)

If possible, what are the expected values for each source type (e.g., "embed", "url", "file", etc.)?

Is there a REST API–compatible way to ensure that when posting via code, the plugin recognizes the video type correctly (so it appears in the front-end player as expected)?

Context

When manually creating a post in the dashboard, these are the UI fields I’m trying to reproduce programmatically:

Image

I’ve already confirmed that _video_embed_content exists, but I’m not sure which meta key controls the “Video Type” selector — the dropdown where you choose “Embed Video”, “Self Hosted”, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions