Question

Workspace published params

  • 10 September 2014
  • 6 replies
  • 0 views

Hello,

 

 

The published parameters can be provided to the workspace using the HTTP POST or GET method. Assuming the GET method is used, then the syntax for the published parameter URL parameters is as follows:

 

 

http://hostname/<service>/<repository>/<workspace>?{ParameterName[=ParameterValue]&}

 

 

but I'm not sure how to provide published params using POST. Could anybody give me an example of this?

 

 

Cheers,

 

john

6 replies

Userlevel 4
Hi,

 

 

for POST messages you will have to pass the parameters in the message body rather than in the URI. This is a property of the different protocols and their design, and not specific to FME Server.

 

 

See here for more info: http://www.w3schools.com/tags/ref_httpmethods.asp

 

 

David
Userlevel 4
Hi,

 

 

I do not know this Firefox plugin, but testing with Chrome and "Postman" should be rather easy: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm

 

 

David
Both the plugins are giving same error as "422 Unprocessable Entity". Any idea why?
Userlevel 4
Have you looked at the FME Server Playground pages? Use it in conjuntion with e.g. Firebug to see how it constructs and sends requests to FME Server.

 

 

http://playground.fmeserver.com/

 

 

David
I have workspace which has been published as a service I can access it by URL http://hostname/<service>/<repository>/<workspace>?{Param1[=Value1]&}

 

 

but want to run this using POST

 

I want to pass published parameters as json

 

e,g,

 

{

 

     "opt_responseformat":"json",

 

     "opt_servicemode":"sync",

 

     "param1":"value1",

 

     "param2":"value2"

 

}

 

 

Is there any changes I need to do to achoeve this?
Badge
Hi JohnG

 

When running a job directly via the service like that the parameter values are expected as form data. You can see the syntax in your Web UI by browsing through the repository to your workspace and clicking Configure and then show developer information.

 

 

To submit a post with json you need use the REST API of FME Server which you can access by entering <host>/fmerest in your browser and clicking on API. Or you can see our online copy here (link is directly to the relevant section):

 

http://docs.safe.com/fme/html/FME_REST/#!/transformations/submit_post_3

 

 

There is a syncronous and asycronous post to submit jobs under Transformations and the API will give you the syntax for the json.

 

 

If you are doing web development a shortcut would be to use our java script library which uses the REST API underneath. You can see samples here of what you are trying to do:

 

http://playground.fmeserver.com/code-samples/general/run-job-asynchronously/

 

http://playground.fmeserver.com/code-samples/general/run-job-synchronously/

 

 

Hope this helps

 

Ken

 

 

 

Reply