HTTP Field Update
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
HTTP Field Update (HFU) is an extremely lightweight module for updating entity fields via HTTP requests. This is not a RESTful implementation and is not intended to be one. Its aim is to provide a very simple and quick way to do bulk updates or have an external system make quick, simple updates to an entity.
What it does:
It's pretty simple, HFU provides the following endpoint:
/hfu/<entity type>/<entity id>
To update a field on that entity, use query parameters in the form of:
?field_machine_name=value_to_set
For example:
http://localhost/hfu/node/123?body='This is some body text';field_some_taxonomy=42
would update node 123's body to the given text and set the term reference field to tid 42.
Authentication:
This module does not implement its own authentication, it relies on standard Drupal authentication. That said, there is nothing preventing it from using a different authentication method provided by some other module.
This may, at first, seem to be a problem for tools like curl since Drupal authentication is cookie based. There is a solution though, --cookie-jar.
Here's how that might work:
Get a login link with Drush:
drush -l http://localhost user-login myusername
Use the --cookie-jar flag to save cookie set on a curl request.
curl --cookie-jar cookie.txt <login link>
Then, you can use that cookie file to make subsequent authenticated requests to Drupal using curl.
curl --cookie cookie.txt http://localhost/hfu/node/123?body='This is some body text';field_some_taxonomy=42
This contrived example can be implemented a thousand different ways with a hundred different languages. However, I hope this give you a starting point to get something done.
