I was tasked to create a service that queries the latest posts from another wordpress site and creates a copy of the post on the wordpress site we manage.
It's a relatively simple task but i can't figure out how to create a media object from the url of the image i get from the original post, so i can attach it as featured media on the post on our website.
https://developer.wordpress.org/rest-api/reference/media/#create-a-media-item
Note: This process is completely authorized from both parties, it's a partnership between the two websites.