We have made a few recent additions to our posting APIs that allow more control when creating posts.

You can now

  • Set a custom slug for the post permalink using the slug parameter.
  • Disable or enable the publicizing of posts, or only publicize to certain services (Twitter, Facebook, etc) using the publicize parameter.
  • Pass a custom message to the above publicize services using the publicize_message parameter.
  • Set the status of a post as “pending review” by passing pending to the status parameter.

When getting a post you can now

  • Find the featured image for a post using featured_image which will return a URL.

2 thoughts on “Platform Updates: Posting Endpoints

  1. Hi, I’m a little confused as to how to use the publicize parameter when passing an array. My code currently constructs an array as follows:

    array('Tumblr', 'Twitter')
    
    to which I am passing to publicize but even if my blog is connected to the appropriate service, the broadcast never appears to have been sent to the external service and on top of that I receive as response that includes the _wpas_skip_tumblr, etc. object.
    
    I've also tried strtolower()'ing the array values as well as passing key => values like array('Tumblr' => 1), but these attempts return the same results.
    
    When I provide a boolean true (or 1), then my publicize broadcasts are sent and appear on the external service.
    
    What am I doing wrong with the publicize array? Thanks for your help or your pointers for a more appropriate place to ask this question.
    1. Hi there,

      Sorry for the delayed reply. Your comment was accidentally caught as spam.

      We support both indexed and associative arrays:
      * indexed are to pass entire services
      * associative are to pass specific connections per service

      We do support mixed arrays: mixed integer and string keys (see 3rd example below).
      1) array( 'twitter', 'facebook') will only publicize to those, ignoring the other available services
      Form data: publicize[]=twitter&publicize[]=facebook

      2) rray( 'twitter' => '(int) $pub_conn_id_0, (int) $pub_conn_id_3', 'facebook' => (int) $pub_conn_id_7 ) will publicize to two Twitter accounts, and one Facebook connection, of potentially many.
      Form data: publicize[twitter]=$pub_conn_id_0,$pub_conn_id_3&publicize=$pub_conn_id_7

      3) array( 'twitter', 'facebook' => '(int) $pub_conn_id_0, (int) $pub_conn_id_3' ) will publicize to all available Twitter accounts, but only 2 of potentially many Facebook connections
      Form data: publicize[]=twitter&publicize=$pub_conn_id_0,$pub_conn_id_3

      We don’t currently expose the connection IDs in the public API though we will begin to do so with a new endpoint soon. Stay tuned to the blog for news on that front.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s