Skip to main content

Hello,

 

I have a FME Server Automation with a Manual Trigger. This FME Server Automation is triggered via the FME Server REST API in a HTTP Caller.

I would like to know if it is possible to set the Output key values (Manual or otherwise) of the Manual Trigger via the body parameter of the HTTP Caller.

And if it is possible, what kind of body should you send?

 

I did find out you can set these in FME Server when you trigger the Automation in the Web UI(Start Automation -> Trigger) when the Manual Trigger parameter of the automation "Prompt for JSON on Trigger" is checked. Then you can set the values for the (Manual) Output Keys. This however can't be used in my process.

 

Thanks in advance,

Hi @waterbeemds​ , yes the /fmerest/v3/automations/workflows/{id}/trigger endpoint supports this:

  1. In your automation, open the Manual Trigger and click Output Keys > Import from JSON
  2. Paste a valid, sample JSON body into the textbox and click Parse
  3. FME Server will create a manual key for each top-level JSON key name
  4. Now you can use the manual key(s) downstream in your automation as needed (for example, emails, logging, other workspaces, etc...)
  5. In the HTTPCaller that calls the FME Server REST API:
    1. enter the JSON in the Body > Upload Body. This is where you can use the text editor and supply dynamic values for the keys 
    2. choose JSON (application/json) as the Content Type

So, for example, if I were to use a sample JSON body of:

{
    "country": "Canada",
    "city": "Vancouver"
}

And parse the keys in the Manual Trigger, two keys will be created, manual.country and manual.city, that can be used downstream in the automation.

 

If I was reading a file of countries and cities and wanted to call the REST API for each feature, I could enter this as my Upload Body JSON in the HTTPCaller:

{
    "country": "@Value(country)",
    "city": "@Value(city)"
}

Please note that this only works for top-level JSON keys. If your JSON is more complicated and has nested objects and arrays, you'll need to flatten them into a more simple structure using the various JSON transformers available in FME. 


Hi Mattmatsafe,

 

I had someone in the company look at it, and together we got the same conclusion as you.

First, set up the Manual key's and link them downstream. You can then use the names of the Manual key's (in your example country and city) in your HTTPCaller body in a correct JSON structure. Make sure you have the Headers "Accept" and "Content-Type" set to application/json.

When running the workspace, you values set in the HTTPCaller body will be used in the Manual keys and then used in downstream actions, like workspaces.

 

Thank you for your reply.


Reply