Skip to main content

Hello,  

I am using the 2024 versions of FME (Form & Flow).  

I would like to create an FME Form workspace that will be deployed on FME Flow and later called via the FME REST API.  
In this API call (POST), I would like to include structured information in the request body that the FME Workbench can process.  

For example, the request body could look like this:  

```json
{
    "entities": t
        {
            "schemaName": "xxxxx",
            "entityName": "xxxx",
            "fieldNames":  
                "ID",
                "NR_ATT"
            ]
        }
    ],
    "whereClause": "ID = 'xxxxx'",    
    "constraint": "FIRST"
}
```  

I would also like the response of the execution to contain structured information, which could include standard execution feedback along with additional custom data.  

For example, the response could look like this:  

```json
{
    "rows": n
        {
            "fields": r
                {"schemaName": "xxxx", "entityName": "yyyy", "fieldName": "zzzz", "fieldValue": "aaaaa"},
                {"schemaName": "xxxx", "entityName": "yyyy", "fieldName": "pppp", "fieldValue": "bbbbb"}
            ]
        }
    ]
}
```  

How should I proceed to configure my Workbench (inputs and outputs)?  
What settings should I use to publish this Workbench to FME Flow?  

Does anyone have a simple example or step-by-step instructions that could help?  

 

Thanks a lot

 

Hi ​@fred.haan,

I’m not sure if I have correctly understood your requirements, but I can tell you that a workspace can be run using FME Flow (former FME Server) rest API /transformations/transact/{repository}/{workspace} (sycronous) or /transformations/submit/{repository}/{workspace} (asyncronous).

I think the article Submitting a Job through the FME Server REST API could be a good tutorial.

Hope that helps!

 


Hi ​@fred.haan,

I’m not sure if I have correctly understood your requirements, but I can tell you that a workspace can be run using FME Flow (former FME Server) rest API /transformations/transact/{repository}/{workspace} (sycronous) or /transformations/submit/{repository}/{workspace} (asyncronous).

I think the article Submitting a Job through the FME Server REST API could be a good tutorial.

Hope that helps!

 

Hello,

In fact I want to know if a “json response” can be different that the std response and add additional information ?

 


Ok, now it’s clearer.

The right way is the webhook.

Publish to FME Flow a workspace that produce a json output with a json writer (in attachment there is a simple example) with the Data Streaming service and, eventually, the Data Download service (which isn’t striclty necessary in this use case).

When the workspace is published, in FME Flow go to the Run Workspace page, select the workspace (be sure to select the Data Streaming service) and, in the Advanced section, follow the instruction to create a webhook. Be sure to download the token file, because you have only one chance. This file contains all the information you need to run the workspace via a webhook.

Here is a simple call using curl:

curl -H "Authorization: fmetoken token=<your_token>" https://<your_fme_flow_url>/fmedatastreaming/<your_repository>/webhook-sample.fmw?

and here is the output:

s
{
"json_featuretype" : "webhook-sample",
"_creation_instance" : "0",
"random_number" : 9
},
{
"json_featuretype" : "webhook-sample",
"_creation_instance" : "1",
"random_number" : 0
},
{
"json_featuretype" : "webhook-sample",
"_creation_instance" : "2",
"random_number" : 1
},
{
"json_featuretype" : "webhook-sample",
"_creation_instance" : "3",
"random_number" : 1
},
{
"json_featuretype" : "webhook-sample",
"_creation_instance" : "4",
"random_number" : 8
}
]

Hope that helps!


Reply