Question

Using POST and body to trigger FME Server workspace.

  • 9 November 2021
  • 10 replies
  • 107 views

Badge +16
  • Contributor
  • 1425 replies

Hi There,

I am pretty sure what the answer is, just covering all bases....

Normally when running a workspace published to FME Server the workspace parameters are populated via the query parameters and therefore the workspace URL contains the parameters provided.

 

Registrating the workspace to the streaming service and defining the streaming output content, allows to provide the requesting application with the transformation results.

 

Another way to run workspaces on FME Server is via the REST API but this does not return the workspace output to the requesting application, since the streaming service is not used.

 

Now my question is: Is it possible to trigger a published workspace by posting the parameters values in the body and NOT in the URL while using the streaming service to return the transformation results to the requesting application? so using a POST + body and getting the transformation results and NOT the job id (async) or job transformation status (synch)

 

Does naybody know if this is possible at all? @david_r​ 


10 replies

Userlevel 5

Perhaps this can get you going?

https://community.safe.com/s/article/send-source-data-to-fme-server-with-http-post

Badge +16

Hi,

Thanks for the tip @david_r​ unfotunatly that is not exactly what I am trying to do. I know you can post files via this method, but as you noticed the FME Server workspace URL still contains parameter values (see last image) and that is something I would like to know how to avoid (if at all possible)

Userlevel 5
Badge +29

Also not a real solution, however, could you set it up in a way for the workspace itself to post the result back with an HTTPCaller? If in needs to be sync then this wont work, however, if you can get away with async this can work. We use a similar process for uploading and processing files.

This is a workaround for the output so you can still call the workspace using the POST method from the REST api.

 

Another alternative would be to just have a JSON reader and send the JSON post body to that reader, parse the JOSN and you can bring in the info from the POST. Also not ideal because then you only have attributes and not parameters but in most cases this would be fine.

 

Sadly both of these are a bit hacky. Best solution would be for the services to be updated to accept POST request for parameters.

Badge +16

Also not a real solution, however, could you set it up in a way for the workspace itself to post the result back with an HTTPCaller? If in needs to be sync then this wont work, however, if you can get away with async this can work. We use a similar process for uploading and processing files.

This is a workaround for the output so you can still call the workspace using the POST method from the REST api.

 

Another alternative would be to just have a JSON reader and send the JSON post body to that reader, parse the JOSN and you can bring in the info from the POST. Also not ideal because then you only have attributes and not parameters but in most cases this would be fine.

 

Sadly both of these are a bit hacky. Best solution would be for the services to be updated to accept POST request for parameters.

Hi @virtualcitymatt​ ,

Thanks for thoughts...as you mention they are quite hacky, and the extra complexity is a serious disadvantage.

Any ideas why the services cannot accept POST? Is that just how FME Server services are built?

 

Badge +16

I think I might have an answer to myself....basically using a topic to trigger the workspace and posting the body....(can I select myslef as best answer 😂 )

But thanks @virtualcitymatt​ and @david_r​ for setting me on the right track...👍

Userlevel 5
Badge +29

I think I might have an answer to myself....basically using a topic to trigger the workspace and posting the body....(can I select myslef as best answer 😂 )

But thanks @virtualcitymatt​ and @david_r​ for setting me on the right track...👍

Ahh nice, yeah that makes sense. Nice workaround

Userlevel 5

I think I might have an answer to myself....basically using a topic to trigger the workspace and posting the body....(can I select myslef as best answer 😂 )

But thanks @virtualcitymatt​ and @david_r​ for setting me on the right track...👍

+1, that's a great idea!

Badge +16

I think I might have an answer to myself....basically using a topic to trigger the workspace and posting the body....(can I select myslef as best answer 😂 )

But thanks @virtualcitymatt​ and @david_r​ for setting me on the right track...👍

Thx guys, one last question using triggers and automations is that a synch or asynch approach?

Userlevel 5

Thx guys, one last question using triggers and automations is that a synch or asynch approach?

Posting to a topic is asynchronous. You cannot get the workspace to return anything through that channel.

Badge +16

Thx guys, one last question using triggers and automations is that a synch or asynch approach?

suspected as much thx @david_r​ 

Reply