Services: node.create + Twitter Post (twitter_post)

Last updated on
17 August 2018

This is documentation for Drupal 7, which is no longer supported. Learn more and find resources for Drupal 7 sites

Twitter Post with Services REST server

Using the twitter_post module with services can be tricky to figure out what field to add to a node when using the POST node.create operation. There are two fields that can be added to the node object:

  • post: string; 1 (true), 0 (false)
  • status: string; "New post: !title !tinyurl", or your custom message.

The twitter pair does not have to be explicitly added to the body. If a new node does not need to be tweeted, simply do not add the twitter pair.

JSON

To use the default twitter post message, add the following field to your node object (node: {}):
"twitter":{"post":"1"}

To change the message, add:
"twitter":{"post":"1","status":"New post: !title !tinyurl"}

An example of a full post is:

{
  "node":{
    "type":"style",
    "title":"I like tweeting!",
    "body":"This is the body ...",
    "twitter":{"post":"1","status":"New drupal post: !title !tinyurl"}
  }
}

XML

If someone needs this use case, please edit the page and update it with your final code. The above in JSON is a pair with an object of pairs.

References

Help improve this page

Page status: No known problems

You can: