Rest-doc Swagger UI returns 404 Resource not found on POST while the service is working nicely e.g. from Postman

0
Last week everything was fine but since my last builds the swagger UI of my app is returning 404 error “resource not found”. The rest service is up and running and works nicely with Postman… e.g. the POST to https://rfc-cheese-board-sandbox.mxapps.io/rest/downtimes/v1/webhook which is documented at  https://rfc-cheese-board-sandbox.mxapps.io/rest-doc/rest/downtimes/v1#/webhook/post_webhook. If you want to test it out use the payload example below or replace the wrong apostrophes in the last line from the payload example in the rest-doc by the inchmark.  Is anyone experiencing similar issues or does anyone have a clue what I might have unconsciously changed?  Payload:  {    "functionalLocation": "313.61.ENC_CP53M01_ENC",    "fromDateTimeUTC": "2019-05-24T01:30:00",    "toDateTimeUTC": "2019-05-24T01:40:09",    "comments": "Postman test indicator kapot spoeltunnel"  } You could try it out in Postman with the settings from the image and Content-Type: application/json
asked
3 answers
1

For me, it works, both in Postman and in the SwaggerUI.

 

My guess is that when you tried it, the app was down because it hadn't been used for a certain amount of time. Accessing the application in a browser will start it up, then the services will probably work again?

 

From the documentation:

“Without a licensed node you can still deploy your app and test it, however it will only run for a couple of hours before shutting down, cannot be scaled and has limited operational information available. “

and

“For a Free App, your app has a single Sandbox environment which allows you to test your app. However, this comes with restrictions on how long it will run.”

answered
0

I think the REST API is confused because there is a Resource name that is equal to the service name (location). But if you run this locally you can set REST-Publish on trace and see what's logged.

 

in postman also 404 btw:

answered
0

Thanks for your replies! Although neither of them was the proper answer, it has led me to the solution. The solution is use the swagger-authorize button to login.

 So thanks for getting me on the right track. 

  1. Last week the Mendix Swagger UI forced me to login if i wasn't already logged in. 
  2. Now it didn't
  3. So i tried to first login with the Swagger UI authorize button
  4. Then I did the post services again and now they were working nicely, no 404 :-)
  5. So the problem was in the authorization.
  6. Switched off “allow anonymous usage” and rebuild, now the Mx  Swagger UI automatically pops up the login 
  7. Switched on “allow anonymous usage” and rebuild, now the Mx Swagger UI does not pop up the login, instead throws a 404 when executing the ‘try out request’

 

So if you have anonymous usage allowed, the swagger UI will not automatically redirect you to the authorize action, but it will throw a 404. This is probably as designed.

 

 

answered