Question

What permissions do I need for a webhook with upload options?

  • 15 July 2021
  • 3 replies
  • 13 views

I've setup a workbench and published it to server that takes a PDF and an XML file as two of it's inputs and I would like to call it via a webhook. It is easy to create a webhook but they appear to assume you will use HTTP GET requests and it is unclear if they can use the upload function.

I think it might have something to do with the additional permissions but is there an example somewhere that shows how to setup a webhook that takes an upload as an input parameter?

I'd also like to know if the requests would be expected to be sent as an HTTP POST request in this context with the relevant parameters including the file with associated mime types?

Any hints would be appreciated.

Thanks


3 replies

Userlevel 4
Badge +26

I thiiink you need to first use a rest call to upload the data to the server. Check out the fme upload service. ​Once the data is uploaded you can run the workspace.

Here's soemthing which should help

https://community.safe.com/s/article/data-upload-part-3-rest-api

Whilst I understand the logic behind it; I think that is a weakness of FME at present as ideally it would be better if you can do all that in a single call. Behind the scenes of course it will be running the data upload before it triggers the workspace but if you run them as separate tasks from the client side then you are returning unnecessary information for my liking. This is because the data upload returns the location of the temporary data which you then need to send back to the server; I think that response also includes the username associated with your permission / token. All this is stuff that is needed by FME server but I'd say is also stuff I'd expect to see handled by the server rather than the client.

 

I would have expected to see a method in the REST API that accepts post with parameters.

 

So if you take transactdata which is the closest I can find (but can't actually get it to work at present). This function accepts only a body but no parameters whilst transact accepts form parameters but doesn't accept file submissions for individual parameters.

 

Anyway, I assume my use case would be classed a niche; they often are but personally I'd prefer to see all this logic wrapped up server side in say a default automation allowing users to make a single API call which will call and run a workspace that accepts file uploads as an input.

Userlevel 4
Badge +26

Whilst I understand the logic behind it; I think that is a weakness of FME at present as ideally it would be better if you can do all that in a single call. Behind the scenes of course it will be running the data upload before it triggers the workspace but if you run them as separate tasks from the client side then you are returning unnecessary information for my liking. This is because the data upload returns the location of the temporary data which you then need to send back to the server; I think that response also includes the username associated with your permission / token. All this is stuff that is needed by FME server but I'd say is also stuff I'd expect to see handled by the server rather than the client.

 

I would have expected to see a method in the REST API that accepts post with parameters.

 

So if you take transactdata which is the closest I can find (but can't actually get it to work at present). This function accepts only a body but no parameters whilst transact accepts form parameters but doesn't accept file submissions for individual parameters.

 

Anyway, I assume my use case would be classed a niche; they often are but personally I'd prefer to see all this logic wrapped up server side in say a default automation allowing users to make a single API call which will call and run a workspace that accepts file uploads as an input.

I'm with you on this Paul, and actually this affects me to on a process too, it doesn't seem niche at all. To me is makes sense. It's possible I'm wrong and there is a way to do this, however, I'm not sure if it.

Of course you can call a workspace with a POST call, and when publishing you can configure a reader to receive the content of the body, however, that only for a single reader.

https://docs.safe.com/fme/html/FME_Server_Documentation/ReferenceManual/service_datadownload.htm

Perhaps part of the reason multiple files aren't supported yet is related to complications when working with different files.

 

Reply