0

I have external site that needs to POST my drupal site (it basically shares data). I need to take the POST data parse it and create a node from it. Is this possible? I have created a PHP file take_post.php this file receives the POST request, parses it creates a node object and then sends it to http://api/v1/node this works fine, though it seems a little long winded?

My problem is that if a post is deleted from the external system a DELETE request is send via HTTP, however the external system has no idea of what the node ID is, and at the point of delete niether do. Is there a way to delete a node without knowing it's NID, maybe via a custom field value?

  • Yep, add a custom field, make sure your external API populates it with an ID it tracks, then create a custom rest resource to find and subsequently delete the content by that field value – Clive Sep 7 '18 at 15:06
0

The UUID field is what you are looking for. It stands for Universal Unique ID.

The UUID is guaranteed to be unique and can be used to identify an entity across multiple systems.

-- from Entity::uuid

  • There external service has no knowledge of the UUID though, it basically sends the same data as POST but as a DELETE request. I need a way to delete the correct node without initially knowing the UUID – Udders Sep 7 '18 at 14:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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