Question

rest api example not working http 400

  • 9 August 2021
  • 8 replies
  • 2 views

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

Userlevel 4

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

 

thanks, that doesn't make any difference

Userlevel 4

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.

Userlevel 4

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.

Badge +16

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/

 

Userlevel 4

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

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

Badge +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

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.

 

Reply