I need some help and guidance.
So I'm developing a website(custom theme) where the goal is to get data from a remote API. I want to be able to store the data in individual posts (one custom post type), and when someone adds or removes data to the remote API it should update the posts on the website.
The API I'm using is structured like this one:
https://pippinsplugins.com/edd-api/products
I know how to get the data from it and decode the JSON etc.
$url = 'https://pippinsplugins.com/edd-api/products';
$username = '*******************'; //This is not necessary for this API
$password = '****************'; //This is not necessary for this API
$headers = array( 'Authorization' => 'Basic ' . base64_encode( "$username:$password" ) ); //This is not necessary for this API
$request = wp_remote_get( $url, array( 'headers' => $headers ) );
if(is_wp_error($request)) {
return false;
}
$body = wp_remote_retrieve_body($request);
$data = json_decode($body);
Is it possible to create a create a custom post type for every product in this APIs and publish it on the website?