Global output
Last updated
Last updated
'Global outputs' is used to define output parameters that can be reused on multiple operations.
A typical use case is when an API returns some kind of error that is always of the same format. The API might return some data depending on the operation with http status code 200. But in case of error it could still return http status code 200, but a different model, containing information about the error. Although each operation has different models in case of success, in the case of failure could be the same.
Note that priority has been set to a number higher than '1' (in this case '10'). The REST connector will try all defined outputs of given http status code until it succeeds, in the order of 'Priority', starting with the one with highest priority (lowest number). Assuming the operation will be successful more often than not, it makes sense to assign a lower priority on the error output.
You can also define a "NEW DEFAULT OUTPUT", which is just like normal "DEFAULT OUTPUT", that is an output for all http status codes not defined by other outputs.
Once you have defined a global output you can add it to any operation. Just select "Outputs" on operation and press the 'ADD GLOBAL' button.
Select output of interest and press 'OK'. You will then be given the option to include the output as a copy or as reference. If added as copy, a new output that looks exactly like the global one will be added to the operation, but there is no connection between the two. So if the global output is changed in any way, the added copy is not affected. If you add it as a reference any changes to the global output will affect the output you added to the operation (it is the same output).