Comments (5)
To read JSON sent from another API to an Elsa Workflow V2 Dashboard HTTP Endpoint, you would typically use the HttpEndpoint
activity to set up an endpoint that can receive HTTP requests. The JSON payload sent to this endpoint can then be accessed within the workflow.
Here's a basic example of how you might define a workflow that reads JSON from an incoming HTTP POST request:
-
Add an
HttpEndpoint
activity to your workflow with the following settings:- Method: POST
- Path: /your-endpoint-path (e.g., /api/data)
-
Add a
RunJavaScript
or similar activity to process the incoming JSON. You can access the JSON payload using theinput
variable, which represents the incoming request content. -
Use expressions to access the JSON properties. For example, if the JSON payload is
{"name": "Elsa", "age": 3}
, you can access thename
property with an expression likeinput.name
.
Here's a sample JSON representation of such a workflow:
{
"name": "ReceiveJsonWorkflow",
"activities": [
{
"id": "http-endpoint",
"type": "HttpEndpoint",
"properties": {
"Method": "POST",
"Path": "/api/data"
}
},
{
"id": "process-json",
"type": "RunJavaScript",
"properties": {
"Script": "return { name: input.name, age: input.age };"
}
}
],
"connections": [
{
"sourceId": "http-endpoint",
"targetId": "process-json"
}
]
}
To execute this workflow, you would send a POST request to https://localhost:5001/workflows/api/data
with a JSON payload.
Here's a sample curl
command to send a JSON payload to the workflow endpoint:
curl --location --request POST 'https://localhost:5001/workflows/api/data' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Elsa",
"age": 3
}'
Please note that the actual endpoint URL and port may vary based on your Elsa Dashboard setup.
For more detailed examples and documentation, you can refer to the Elsa Workflow documentation and samples provided in the context section, specifically the HTTP Backend API and HTTP Post Users API samples.
from elsa-core.
Is "type": "RunJavaScript", available in Version 2.13 Dashboard. If not which activity should I use.
from elsa-core.
Can someone respond please. Is "type": "RunJavaScript", available in Version 2.13 Dashboard. If not which activity should I use. I am unable to see RunJavaScript in 2.13 version.
from elsa-core.
Yes, but it's not added to the system by default. To make it available, you need to call AddJavaScriptActivities
on the elsa options builder.
from elsa-core.
This guide covers a similar scenario where it demonstrates reading a payload sent to an HTPT Endpoint activity.
from elsa-core.
Related Issues (20)
- Literal Expression Descriptor's Deserialize Function Incomplete JsonElement Handling HOT 1
- Activity Output issues after upgrading to 2.14.1 HOT 3
- Urgent: Issue with Job Duplication During Server Crash and Restart in distribution server HOT 10
- Shadow properties not working with PostgreSQL HOT 1
- Issue with UTF-8 Characters Escaping During Deserialization HOT 1
- Sqlite database persistence with Docker HOT 3
- Sample Workflows do not work HOT 2
- RunTask Payload input in ElsaStudio Designer HOT 2
- Missing text parser for HTTP requests
- Workflow Instances GET Endpoint - Broken Statuses and SubStatuses Filters
- unable to use simple configuration of HttpRequest with content-type application/x-www-form-urlencoded HOT 1
- Add dry run option to alterations HOT 1
- workflowRunner.RunAsync is not retuning Result when trying to resume workflow. HOT 2
- What should we pass as a first parameter HOT 2
- Optimize import of workflow definitions HOT 2
- Http Flow HOT 1
- How to invoke HTTP Endpoint in the middle of an executing workflow? HOT 1
- Hello, how can I reset "Completed" in Activity Status to "Running"?
- How to notify the changed status of activity to the business system ? HOT 1
- how to pass input to workflow and activity while executing the workflow HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elsa-core.