Skip to main content
Solved

FME Cloud post request


oliver.morris
Contributor
Forum|alt.badge.img+12

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"}

]}

Best answer by gerhardatsafe

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 >

View original
Did this help you find an answer to your question?

10 replies

oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 28, 2019

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"

}


oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 28, 2019

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" } ] }


david_r
Evangelist
  • January 28, 2019

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


oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 28, 2019
david_r wrote:

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.


david_r
Evangelist
  • January 28, 2019

Could you also post the failed job log?


oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 28, 2019
david_r wrote:

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


Forum|alt.badge.img

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 >


david_r
Evangelist
  • January 29, 2019
oliver.morris wrote:

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.


oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 29, 2019
gerhardatsafe wrote:

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.


oliver.morris
Contributor
Forum|alt.badge.img+12
  • Author
  • Contributor
  • January 29, 2019
david_r wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings