One of the most common questions I get from customers who are first learning our Application Integration product is:
"How do I add to the API request payload or Response Payload in Integration when I'm using an API Trigger?"
This is actually quite simple to do! First, a good understanding of variables and how integration uses variables is needed. Some variables are generated by various triggers or tasks that you configure in your integration. Other variables can be created by the user so that data can be stored as it's being processed from task to task. The data mapper is a very common place where you need to create additional variables, either to stage some data for further processing, or to create a variable in the right data type and structure for the input needed for further tasks, edge conditions or as an output to the integration (API Response).
So the first thing to consider is how to create the variables that you want, using the correct data type (ie: String, Integer, JSON, String Array, etc...), and where that variable will be used in your integration. If you want it to be an input to the integration's API trigger, then there is a simple checkbox configuration on the variable definition to check, and then the API trigger will expect it to be part of the Request Payload. There is another checkbox for Output, which means the variable will be placed in the Response Payload. A single variable can also be both an input and an output if that makes sense for your use case (perhaps you just modify some of the values, but it has the same type/structure). You can check this box on system generated variables as well, by the way. Here's a screenshot of the variable definition with the checkboxes that you would use outlined in the red box:
In this example, I've configured this variable: "MyInputStringArray", of type "String Array" to be an input to my integration. The default value is a handy feature that will pre-fill the testing input with the values I've placed here to make my unit testing step that much easier. You can see I set the default to "orange, banana, grapefruit, peach", so that I can have a simple test case prepopulated. Here is what it looks like when I test this integration from the UI:
I can always override these test values when I'm testing, but I've found it very useful to pre-populate with a default value so that I don't have to keep a bunch of test inputs somewhere else (like a text file on my laptop or whatever)....especially with complex JSON structures. You can also easily change this default value in the variable definition as you iterate through your development cycle and learn more about the inputs/outputs of the various applications you are integrating.
I hope this helps! Please comment if you have any questions.