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 thestatus
parameter.
When getting a post you can now
- Find the featured image for a post using
featured_image
which will return a URL.
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: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 servicesForm 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 connectionsForm 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.