0

I'm running a tomcat server with a REST service on localhost.

This url typed in the browser gives me a json response: http://localhost:8080/a/rest/dataset/list

But when I use curl: curl http://localhost:8080/a/rest/dataset/list the response is HTML code with a 404 error from the server.

What am I missing in the curl command?

2
  • Are there any expected HTTP parameters/cookies on the server side ? Commented Apr 4, 2013 at 9:05
  • Hi Halim, no there aren't.
    – Mirko
    Commented Apr 4, 2013 at 9:22

1 Answer 1

1

Tomcat may be waiting for a specially formatted HTTP request from the user. As you are expecting a response in json, you should probably forward the following argument to curl :

-H 'Content-Type: application/json'

Also, you may always specify to whatever HTTP server the response you are expecting him to return. A lot of back-end application based on HTTP are issuing a response given the HTTP request.

1
  • 1
    doh, after one hour staring at the screen: it was actually a typo in the path to the service. the server name was correct, so it got something, but did not return json. Thanks anyway Halim...
    – Mirko
    Commented Apr 4, 2013 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.