Updating a Drupal node using Services
We have been using Drupal's Services module for a website, allowing a process that creates content in one platform to create new nodes in the Drupal site whenever a new piece of content is created. Easy to accomplish; we found many examples online showing how to create nodes.
We have a new requirement for which the remote system needs to update one of the Drupal site's nodes. Turned out to be more tricky and the web had fewer examples of how to do it. Here's how we did it (remember that you need to request an X-CSRF-Token and maybe authenticate, depending on your content permissions):
Find the node that we need to update
The remote system doesn't have the node id for the piece of content that it needs to update, so we created a view (view machine name "find_content") with two contextual filters that returns one nid (the most recent one - sort by post date, desc). To retrieve the node id matching those two contextual filters, we used this call: