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
View original