Hi,

Is there a way I can add new nodes and update existing ones (if I have the uuid or nid) from an external process (php/python) that would run on the same server as Drupal.

Is there any API Drupal exposes that can be used for that?

Can I program a module that would be used as such API?

Another option is to store the new and updated nodes' data in a DB and write a module that reads and updates Drupal nodes, but I don't know how to make this module run every N minutes without user interaction? (can it be done with cron?)

* latest Drupal 9.x *

Any ideas are welcome

Thanks.

Comments

jaypan’s picture

Yes. Drupal comes packaged with a REST server which can be used to perform actions on the site, and can be customized to add additional actions/methods if necessary.

https://dev.acquia.com/blog/decoupling-drupal-8-core-core-rest-hal-and-s...

Contact me to contract me for D7 -> D10/11 migrations.

amirn’s picture

I've installed and enabled the modules as showed in the article you've linked.

I was able to use a GET to retrieve a node, but I was only able to do it using anonymous user, do you know how can I use a registered user/password to do that?

Thanks.

jaypan’s picture

You can use the OAuth2 server module to create an authentication server.

Contact me to contract me for D7 -> D10/11 migrations.