How to send POST/PATCH Json payloads (via http_client_manager)?

Created on 9 January 2025, about 1 month ago

Problem/Motivation

Hi,

I've reviewed the excellent videos on "ECA and http services" at https://tube.tchncs.de/c/eca/videos.

I'm trying to accomplish the reverse of what's demonstrated in the video: I'd like to send data to other (Drupal) sites via ECA in reaction to an event (inserting of an entity). I've walked through all the steps and when generating the HTTP services module, instead of GET I chose POST. From that point onwards, I'm pretty much lost in the woods.

1 - In the HTTP client manager UI I can see my newly created service and it has one command: Send data.
2 - I have a new action in ECA as a result of creating the new service, but it has no options other than "Replace tokens".
3 - I'm unsure if I configured the URI correctly, I followed the steps from the video but that uses an internal URL. Should there be a service for each destination site, and should that endpoint be used as the URL?
4 - I don't know how to generate a JSON payload via ECA but I'm pretty sure it's possible.

Maybe I'm taking the wrong approach to this, the ultimate goal is to have ECA respond to the creation of an entity, generate a bunch of data, format the data as JSON and send it to an enpoint, ideally with the option of logging and storing the response.

Thanks in advance for any guidance on this.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.1

Component

Documentation

Created by

🇹🇭Thailand AlfTheCat

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @AlfTheCat
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Moving this over this the http_client_managaer module, since that provides the action plugins that are then available to ECA. I'm not a regular user of that module, but I seem to remember that it requires a service being defined for each endpoint and operation.

    When it then comes to preparing the data that will be sent, you can e.g. load an entity into a token and then call the serialize tamper plugin to get this into a json string that can then be sent to a remote service.

  • 🇹🇭Thailand AlfTheCat

    Hi @jurgenhaas, thank you.

    In the meantime, I found the ECA Helper module . I can't get it to work yet but it seems to/should be able to send JSON payloads to an endpoint. I'm not sure if it requires something similar regarding the data preparation, but I don't think so if I'm reading the config field descriptions correctly. I've opened a support request in the queue under: 💬 Keep getting 400 Bad Request` - "No entity content received." Active .

Production build 0.71.5 2024