REST - Body Parameters in POST Method - Forum - OpenEdge General - Progress Community

REST - Body Parameters in POST Method

 Forum

REST - Body Parameters in POST Method

  • Hi,

    I have defined two REST methods, GET and POST (See images attached).

    GET it's working fine and response is OK. The problem is in POST because of web parameters. I'm using restClient for Firefox.

    This is the wadl.

    <application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <grammars/>
    <resources base="http://10.250.0.220:8080/Project/rest/Producte">
    <resource path="/Producte">
    <method name="GET">
    <request>
    <param name="piCodProd" style="query" default="" type="xs:string"/>
    </request>
    <response status="204"/>
    </method>
    <method name="POST">
    <response status="204"/>
    </method>
    </resource>
    </resources>
    </application>

    I'm trying to call service via POST method with the URL "http://{myIP}:8080/Project/rest/Producte/Producte", and in Body:

    {pcNamProd:"ProductOne"}

    This should be insert de "ProductOne" Product in database but I have this error.

    1. Status Code: 415 Unsupported Media Type
    2. Content-Length: 0
    3. Date: Tue, 21 May 2013 12:09:34 GMT
    4. Server: Apache-Coyote/1.1

    Can anyone tell me what I'm doing wrong?

    Tx!!

    Mapping_GET.jpg

    Mapping_POST.jpg

  • I'm running into the same problem, the "415, unsupported media type". Did you solve it somehow?

    I get this when I want to test my REST service from PostMan, which is a Chrome app for HTTP calls.

  • Is the Content-Type header set correctly to application/json?

  • I thought the tool did, but apparently not. Setting the Content-Type header "manually" did he trick. Thanks!