Skip to main content
Question

rest api example not working http 400


rightdirection
Contributor
Forum|alt.badge.img+2

i am trying this example:

https://playground.fmeserver.com/using-the-rest-api/jobs/

 

the synchronous job start from a fresh local FME server installation

I can succesfully execute the query to get the parameters of the workbench

 

but starting the job returns in a http 400

I use postman

 

the token can be generated as well succesfully

 

how can i figure out what i did wrong?

postman fme server2postman fme server

8 replies

david_r
Celebrity
  • August 9, 2021

Try also including the other directives shown in the example, not just the published parameters. Example:

{
  "publishedParameters": [
    {
      "name": "MAXY",
      "value": "42"
    },
    {
      "name": "THEMES",
      "value": [
        "airports",
        "cenart"
      ]
    }
  ],
  "TMDirectives": {
    "rtc": false,
    "description": "",
    "tag": ""
  },
  "NMDirectives": {
    "directives": [],
    "successTopics": [],
    "failureTopics": []
  }
}

 


rightdirection
Contributor
Forum|alt.badge.img+2

thanks, that doesn't make any difference


david_r
Celebrity
  • August 9, 2021

Works for me (using Insomnia rather than Postman, but otherwise identical):

fme server transact apiIf you still get error messages, check the FME Server log files for hints.


david_r
Celebrity
  • August 9, 2021

I see the issue now, you seem to be missing a part of the endpoint URL. It should be

.../transformations/commands/transact/...

In the screenshot you're missing the "commands" part.


warrendev
Enthusiast
Forum|alt.badge.img+24
  • Enthusiast
  • August 9, 2021
david_r wrote:

I see the issue now, you seem to be missing a part of the endpoint URL. It should be

.../transformations/commands/transact/...

In the screenshot you're missing the "commands" part.

Hi @david_r​ , can I ask where the "commands" portion of the url comes from? I don't see this anywhere in the FME Server Rest API V3 documentation. It shows this as: 

/fmerest/v3/transformations/transact/

 


david_r
Celebrity
  • August 9, 2021
warrendev wrote:

Hi @david_r​ , can I ask where the "commands" portion of the url comes from? I don't see this anywhere in the FME Server Rest API V3 documentation. It shows this as: 

/fmerest/v3/transformations/transact/

 

You're right, thanks for catching this! My example was (unintentionally) using v2 of the API, which explains the different endpoints.

I redid my tests with the v3 endpoint and otherwise the exact same parameters, and it also works as expected:

fme server transact api v3


rightdirection
Contributor
Forum|alt.badge.img+2

i will close the issue, it is postman related, I wrote a python-script and how no issues at all :-( bit weird to be honest but that is how it is


Forum|alt.badge.img+2
trd2021 wrote:

i will close the issue, it is postman related, I wrote a python-script and how no issues at all :-( bit weird to be honest but that is how it is

Hi @trd2021​ ,

 

I'm glad you were able to get it working with a Python Script. It is very curious that it is not working for you in Postman. I don't know if you want to try and troubleshoot this, but just in case you do I thought I'd note that one odd thing about the 400 Bad Request response that is returned is that it is HTML. Since your Content-Type header is set to application/json the response should be JSON, and usually, it would return a message with a clear error explaining the bad request e.g. if I edit the body to make it invalid the response is:

 

Screen Shot 2021-08-09 at 1.18.19 PMIs there anything in the HTML body that might explain where this message is coming from. If you can save and share the response I'd be happy to take a closer look as well.

 


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