• Hi, we have a website that receiving product update via WP Restful API. Is there any way we can automatically trigger the Broadcast to fire after the WP Restful API update ?

    • This topic was modified 4 years, 10 months ago by kimwahwong.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    I have an API that can be called: https://broadcast.plainviewplugins.com/doc/developer-api/

    As a suggestion, without knowing anything about the Restful API, you can hook into an action there and broadcast the product to other sites:

    add_action( 'restful_product_updated', function( $product_id )
    {
     ThreeWP_Broadcast()->api()->broadcast_children( $product_id, [ 2, 3, 4 ] );
    } );

    Something like that…

    Thread Starter kimwahwong

    (@kimwahwong)

    Thanks Edward,
    I have added the update_children into the “save_post” action, it is working now. The draw back is that the Restful Post is taking long time to finish, I guessed once it called the “update_children” , the process to broadcast is slow.
    Do you have any api that we can do it like push the “update_children” into the broadcast queue, which is like the process we click product “update” button ?

    Plugin Author edward_plainview

    (@edward_plainview)

    Oh, if you want things put into the queue then put the API into low priority.

    $api = ThreeWP_Broadcast()->api();
    $api->low_priority();
    $api->broadcast_children( $product_id, [ 2, 3, 4 ] );

    Hope that works better for you.

    Thread Starter kimwahwong

    (@kimwahwong)

    Thanks Edward, with the low_priority(), the process is working fine now.

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

The topic ‘Trigger Broadcast After Restful API Update’ is closed to new replies.