Skip to main content

Hi I am trying to run this POST request but it doesn't pass the parameter correctly, can anyone kindly suggest what I am doing wrong? I am trying in Postman first and then will change it to work in SQL Server

Thank you

 

POST /fmerest/v3/transformations/transactdata/office_tasks/ROCK_PROPERTY_TO_TEAM.fmw?fmetoken=41544e72aac7b3da0b9095eac0cbdc23120b6d97 HTTP/1.1

Host: xxx.fmecloud.com

Content-Type: application/json

cache-control: no-cache

{ "publishedParameters":

{"name": "file_path","value": "Rock_Properties_Upload_TEST1.xlsx"}

]}

it is something to do with the body, when i just use the default, without the body it works fine.

{

"timeRequested": "2019-01-28T16:33:33Z",

"requesterResultPort": 46477,

"numFeaturesOutput": 16510,

"requesterHost": "10.0.0.81",

"timeStarted": "2019-01-28T16:33:33Z",

"id": 325702,

"timeFinished": "2019-01-28T16:34:12Z",

"priority": -1,

"statusMessage": "Translation Successful",

"status": "SUCCESS"

}


I took the published parameters straight from the FME server Rest API page which when run works fine:

{ "publishedParameters": [ { "name": "file_path", "value": "Rock_Properties_Upload_TEST.xlsx" } ] }


What exactly do you mean by "doesn't pass the parameter correctly "? What does the job log say about this parameter?


What exactly do you mean by "doesn't pass the parameter correctly "? What does the job log say about this parameter?

thanks for the help David,

 

I just get:

{

"timeRequested": "2019-01-28T17:02:57Z",

"requesterResultPort": 45111,

"numFeaturesOutput": 0,

"requesterHost": "10.0.0.81",

"timeStarted": "2019-01-28T17:02:57Z",

"id": 325729,

"timeFinished": "2019-01-28T17:02:58Z",

"priority": -1,

"statusMessage": "java.nio.file.DirectoryNotEmptyException: /data/fmeserver/resources/temp/geochem/office_loader",

"status": "FME_FAILURE"

}

 

Which basically is telling me it is trying to create a file where a folder currently is (from a previous run) the reason it is trying to create a file is that the parameter isnt being included in the POST

 

yet run I run it with the FME Server RestAPI webpage interface it is fine and shows up in the published parameters.


Could you also post the failed job log?


Could you also post the failed job log?

job_325770.txt

The real reason is that the parameter isnt being passed, so there is something wrong with the api call I think - is it to do with the location of the fme token?

 

Thank you


Hi @olivermorris The POST /fmerest/v3/transformations/transactdata endpoint is expecting a file as body and not a published parameters with the filename in it:

https://docs.safe.com/fme/html/FME_REST/apidoc/v3/index.html#!/transformations/post_post_24

If you want to submit a job with certain published parameters please have a look one these endpoints:

POST /transformations/transact/< repository >/< workspace >

POST /transformations/submit/< repository >/< workspace >


job_325770.txt

The real reason is that the parameter isnt being passed, so there is something wrong with the api call I think - is it to do with the location of the fme token?

 

Thank you

Regardless, I would not recommend passing the token on the URL, for security reasons. My recommendation is to put the token in the header.

Other than that, I suspect that @GerhardAtSafe is right.


Hi @olivermorris The POST /fmerest/v3/transformations/transactdata endpoint is expecting a file as body and not a published parameters with the filename in it:

https://docs.safe.com/fme/html/FME_REST/apidoc/v3/index.html#!/transformations/post_post_24

If you want to submit a job with certain published parameters please have a look one these endpoints:

POST /transformations/transact/< repository >/< workspace >

POST /transformations/submit/< repository >/< workspace >

Thank you, I was just using the wrong endpoint, worked immediately after the change. Thanks Gerhard.


Regardless, I would not recommend passing the token on the URL, for security reasons. My recommendation is to put the token in the header.

Other than that, I suspect that @GerhardAtSafe is right.

Thanks David, yes I agree, although this is embedded within a stored procedure on sql server so the end user doesnt see any of it and it is just for internal use. Thanks for the help.


Reply