I have a requirement where I will have to insert content (nodes) from the command line. I know that drupal bootstraping is needed to acces the environment, and this can be done using PHP.

Is there any tool that can create/modify/read content from the command line ? Are there any other programming language binds (besides PHP) ? What are the options ?


I think the best option would be to go with the Services module. About the module from the project page:

A standardized solution of integrating external applications with Drupal. Service callbacks may be used with multiple interfaces like REST, XMLRPC, JSON, JSON-RPC, SOAP, AMF, etc. This allows a Drupal site to provide web services via multiple interfaces while using the same callback code.

You can build the other application (like android app, Java app, and many more...) in any programming languages you like and make the application interact with Drupal using Services. There is an extensive documentation available which would help you through.
Take time to read through the project page (as it contains more resources to explore) and the documentation as it might take time to get accustomed with the module (as it happened with me).

For command line access to Drupal there is a "Command line shell and scripting interface" - Drush (Drupal Shell). List of the Drush commands could be found at this site. It is very powerful utility for Drupal developers (on Windows, Ubuntu Linux, Mac, etc.); but I'm not sure if one is able to create/modify/read content (nodes) with Drush though, I think one cannot do that (please correct me if I'm wrong).

  • In the end this seems to be the best approach. – drcelus Nov 26 '12 at 14:38
  • 1
    @drcelus if that is the case you should also have a look at this session : Services Inside out at DrupalCon Denver. It shows similar examples towards the end. – AjitS Nov 26 '12 at 14:45

You can check Drush and Drush Entity. Drush is a powerfull command line script for drupal and you can do a bundle of thing with it (install module, clear cache...). I have never worked with Drush Entity but it add interactions with entities for Drush.

  • Unfortunately, the project lacks any kind of documentation and thus it's really hard to start with. – drcelus Nov 26 '12 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.