Forum Discussion

erikmollerberg's avatar
erikmollerberg
New Contributor
10 years ago

Rest api - post with JSON body

Hi,

 

When I try to post a request with json body the request looks ok in the request raw view but response  is 400 bad request. What have I missed?

(Opening the testcase tells me "missing parameter/body definitions for request") but I have set "Media type" to "application/json"

1 Reply

  • cperrot's avatar
    cperrot
    New Contributor

    I have the same problem. When I change the Content-Type to application/json I get an error.

     

    In general it seems that Media-Types are being ignored to and defaulted to application/xml if the REST server supports application/xml.

     

    If I change the REST server to only support application/json voila everything works fine.

     

    Back in version 3.x one could choose which return type one wanted based on the REST Server capabilites. e.g. application/xml or application/json in my case.

     

    What has changed? It seems that this new version is a step back in useability.

     

    Regards

     

    Cedric