Question

Submit json data using FME REST

  • 24 February 2023
  • 1 reply
  • 21 views

Badge

Hi folks

 

I know this question has been asked before and there is a way to post json data directly via an HTTP Post Request as described here.

 

The thing is that the web developer needs:

 

  • An async process
  • A download job
  • And the Job-ID returned back (which would work out using the param "opt_responseformat=json" when using http post - but it returns actually too much information which I see critical in terms of security)

 

Regarding FME REST, I could not figure out how I ever could submit a job together with a JSON to be processed via FME as a result from the users selection on the frontend. The "fmerest/v3/transformations/submit/" would not accept my JSON to be used in the published parameters (I chose a simple text parameter to be fetched in FME for further processing).

 

However, I get a 422 response (unprocessable entity). Do you have any suggestions what I can do here? Any alternatives that might work out better?

 

Any help / hint is appreciated!

Thanks in advance!

Postman_Screenshot


1 reply

Badge +7

Hi @fungergis​ , the 422 error indicated invalid parameters; you may be receiving it because quotes within JSON values haven't been escaped. For example:

"publishedParameters": [
    {
      "name": "PARAMETER",
      "value": "{\"type\":\"Point\",\"coordinates\":[-122.848614,49.081051]}"
    }

I'm not sure what you mean by a download job, but if you are referring to the data download service, the REST API does not currently support this, because it goes through a different service. You can create a webhook URL from your workspace instead. Choose the data download service prior to creating the webhook URL. Please see:  https://community.safe.com/s/article/Submitting-a-Job-through-FME-Server-Webhook-URLs#Part3

It is a synchronous call though that returns the data download URL

 

Reply