On this page
Services: node.create + Twitter Post (twitter_post)
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
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion