This is usually a very tricky question in Integray. What should I create as the first:
- Task and then endpoint
- Endpoint and then task
I usually start with task. I leave it on the manual trigger and as a first step, I always add JS Mapper without input schema and with output schema that will be used for the endpoint input (for example it will have two fields “field1” as string and “number” as an integer. Then I add a simple code into JS mapper like this:
return [{
"field1": "value1",
"number": 0,
}];
This will simulate my input and I can put as many variants of input as I wish without the need of sending the data to the endpoint. Once my task is fully finished and tested then I create an endpoint with proper input schema and connect it to the task.
As I don’t want to lose the mapping of the tasks step I do not delete this first step but rather change the code to:
return inputData;
This will pass all input data into the output without any changes. Later I can use these steps for testing or even data validations before it goes to other steps.