Skip to main content
Solved

FME server webhooks: passing geojson polygon-coordinates in URL

  • December 7, 2021
  • 2 replies
  • 88 views

becchr
Influencer
Forum|alt.badge.img+32

Hi, taking my first steps in the FME REST API and webhooks, and struggling on passing coordinates.

 

I published a simple workspace to FME server using the Geometry Pïcker as only parameter, the drawn polygon is noted in GeoJson, like:

{"type":"Polygon","coordinates":[[[3.732869,51.016178],[3.733537,51.016688],[3.734896,51.015998],[3.734086,51.015473],[3.732869,51.016178]]]}

 I created a webhook from this workspace, the URL preview shows the special characters should be encoded, like:

https://FMEserver/workspace.fmw?DrawnPolygon=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B3.732869%2C51.016178%5D%2C%5B3.733537%2C51.016688%5D%2C%5B3.734896%2C51.015998%5D%2C%5B3.734086%2C51.015473%5D%2C%5B3.732869%2C51.016178%5D%5D%5D%7D&opt_showresult=false&opt_servicemode=sync  

but, when I GET-request through this URL, the workspace fails:

55	2021-12-7 17:05:35 | A JSON syntax error was found at line 1, column 2
56 2021-12-7 17:05:35 | Unexpected character: 't'. One of the following characters was expected: '"', '}'
57 2021-12-7 17:05:35 | The value of the import attribute '__GeometryReplacerTemp__' contained invalid JSON, and could not be parsed
58 2021-12-7 17:05:35 | The below feature caused the translation to be terminated

Looks like the polygon is not decoded correctly, as it is missing the "-characters?

62	2021-12-7 17:05:35 | Attribute(encoded: UTF-8) : `_DrawnPolygon' has value `{type:Polygon,coordinates:[[[3.732869,51.016178],[3.733537,51.016688],[3.734896,51.015998],[3.734086,51.015473],[3.732869,51.016178]]]}'
 
72 2021-12-7 17:05:35 | GeometryReplacer_<Rejected> (TeeFactory): GeometryReplacer_<Rejected>: Termination Message: 'GeometryReplacer output a <Rejected> feature. To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

Am I missing something? Should I encode/decode in a different way?

 

At the end, I hope to get input from a user through a custom webmap (ArcGIS Online and/or Leaflet), and use webhooks/RESTAPI to launch FME server workspaces, so there might be more convenient ways to do this, just trying to understand what goes wrong for now...

Best answer by hollyatsafe

Update: This issue has been resolved for FME 2022.0. 

 

Hi @becchr​ , 

 

I'm sorry that you encountered this problem, I have been able to reproduce the issue you have described and I believe the problem is with how FME is storing the parameter value in the command line arguments when submitted via a Webhook. I have filed a bug to request this fix (internal reference: FMESERVER-17647) and will update this post when it is resolved. 

In the meantime, you can workaround this issue in one of two ways: 

 

1. In the Webhook URL replace the quote encoded reference (%22) with <quote> e.g. 

https://FMEserver/workspace.fmw?DrawnPolygon=%7B<quote>type<quote>%3A<quote>Polygon<quote>%2C<quote>coordinates<quote>%3A%5B%5B%5B3.732869%2C51.016178%5D%2C%5B3.733537%2C51.016688%5D%2C%5B3.734896%2C51.015998%5D%2C%5B3.734086%2C51.015473%5D%2C%5B3.732869%2C51.016178%5D%5D%5D%7D&opt_showresult=false&opt_servicemode=sync

2. In the Workspace, fetch the parameter into an attribute and use a series of StringReplacer transformers to add quotes around type, polygon and coordinates before feeding the attribute into the GeometryReplacer. 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

Forum|alt.badge.img+2
  • Best Answer
  • December 20, 2021

Update: This issue has been resolved for FME 2022.0. 

 

Hi @becchr​ , 

 

I'm sorry that you encountered this problem, I have been able to reproduce the issue you have described and I believe the problem is with how FME is storing the parameter value in the command line arguments when submitted via a Webhook. I have filed a bug to request this fix (internal reference: FMESERVER-17647) and will update this post when it is resolved. 

In the meantime, you can workaround this issue in one of two ways: 

 

1. In the Webhook URL replace the quote encoded reference (%22) with <quote> e.g. 

https://FMEserver/workspace.fmw?DrawnPolygon=%7B<quote>type<quote>%3A<quote>Polygon<quote>%2C<quote>coordinates<quote>%3A%5B%5B%5B3.732869%2C51.016178%5D%2C%5B3.733537%2C51.016688%5D%2C%5B3.734896%2C51.015998%5D%2C%5B3.734086%2C51.015473%5D%2C%5B3.732869%2C51.016178%5D%5D%5D%7D&opt_showresult=false&opt_servicemode=sync

2. In the Workspace, fetch the parameter into an attribute and use a series of StringReplacer transformers to add quotes around type, polygon and coordinates before feeding the attribute into the GeometryReplacer. 


arthur_bazin
Contributor
Forum|alt.badge.img+18
  • Contributor
  • July 28, 2025

Hi, i’m experiencing the same trouble with FME Flow 2025.1.0.1 - Build 25609 - win64.

Impossible to have the quoted value in FME.

The request part as send by the browser : 

spatial_extent=%7B%22type%22%3A%22FeatureCollection%22%2C%22features%22%3A%5B%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22coordinates%22%3A%5B%5B%5B7.050…

Into the log :

2025-7-28 13:42:46 | FME Configuration: Command line arguments are `fme' `my-script.fmw' `--FME_SERVER_REQUEST_URI' `http://xxx/my-script.fmw?opt_showresult=true&opt_servicemode=async&opt_responseformat=json&spatial_extent=%7B%22type%22%3A%22FeatureCollection%22%2C%22features%22%3A%5B%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22coordinates%22%3A%5B%5B%5B7.050...'

`--spatial_extent' `{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[7.050….]]],"type":"Polygon"}}]}'

=> The quote are used into the command line invoked by the webhook

 

Into the workspace I’ve added a logguer with this parameter :

{type:FeatureCollection,features:[{type:Feature,properties:{},geometry:{coordinates:[[[7.050…

=> There isn’t any quote

 

The parameter is a text parameter