โ02-16-2023 03:51 PM
I am trying to create a custom REST API call. I am able to get the JSON payload required and use Workato to generate a schema form that. However, I am stuck when dealing with fields that are allowed to have blank values.
If I make the field optional it is not being included in the payload if blank. If I make it mandatory it won't let me not populate it and run the recipe.
Any ideas?
Solved! Go to Solution.
โ02-17-2023 05:36 AM - edited โ02-17-2023 05:38 AM
Hey @bboren,
If you 'skip' the fields that are left blank when you run the recipe, are they still included in the payload?
You can learn more on that here: https://docs.workato.com/formulas/other-formulas.html#skip
This section on creating a new access profile for API may also be helpful: https://docs.workato.com/api-mgmt/api-client-mgmt.html#create-new-access-profile
Please let me know if neither of these resources are helpful in your case. I may need more info on your specific use case in order to better assist.
If you would like to submit a ticket for support, you may do so here.
โ02-17-2023 06:00 AM
One weird trick I've had to use in the past for things like this is to define a variable called "empty", leave it null, and then assign it to the required parameters. That way the recipe will save, but it doesn't pass anything at runtime.
โ02-17-2023 05:36 AM - edited โ02-17-2023 05:38 AM
Hey @bboren,
If you 'skip' the fields that are left blank when you run the recipe, are they still included in the payload?
You can learn more on that here: https://docs.workato.com/formulas/other-formulas.html#skip
This section on creating a new access profile for API may also be helpful: https://docs.workato.com/api-mgmt/api-client-mgmt.html#create-new-access-profile
Please let me know if neither of these resources are helpful in your case. I may need more info on your specific use case in order to better assist.
If you would like to submit a ticket for support, you may do so here.
โ02-17-2023 06:00 AM
One weird trick I've had to use in the past for things like this is to define a variable called "empty", leave it null, and then assign it to the required parameters. That way the recipe will save, but it doesn't pass anything at runtime.
โ02-21-2023 03:36 PM
This worked too. The skip option in the scripting allows you to avoid creating a variable just to handle a blank value.
โ02-22-2023 07:27 AM
Yea I probably should've qualified that more.. the times I've used the "blank" variable has really just been in Unit Tests when calling recipes that have a required input that I wanted to be blank in certain Test Scenarios. But in "normal" recipes I've used the skip function as Meghan described.