Layer7 API Management

  • 1.  RESTMAN error Unsupported Media Type when using curl

    Posted Oct 17, 2016 12:11 PM

    I have a RESTMAN bundle.  I can PUT it to my gateway using Firefox RESTClient.  I get an error when using curl for the same operation.

     

    Command is:

     

    curl -u admin:mypassword -X PUT -k -H ‘Content-Type:application/xml’ -d @bundleVoonair.xml -D - https://explore.apim.ca:8443/restman/1.0/folders/bundle

     

    Response:

     

    HTTP/1.1 100 Continue

     

    HTTP/1.1 415 Unsupported Media Type

    Server: Apache-Coyote/1.1

    Content-Type: application/xml

    Content-Length: 569

    Date: Mon, 17 Oct 2016 16:06:03 GMT

     

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

    <l7:Error xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">

        <l7:Type>NotSupported</l7:Type>

        <l7:TimeStamp>2016-10-17T12:06:03.379-04:00</l7:TimeStamp>

        <l7:Link rel="self" uri="https://explore.apim.ca:8443/restman/1.0/folders/bundle"/>

        <l7:Detail>HTTP 415 Unsupported Media Type. Caused by: MessageBodyReader not found for media type=application/x-www-form-urlencoded, type=class com.l7tech.gateway.api.FolderMO, genericType=class com.l7tech.gateway.api.FolderMO.</l7:Detail>

    </l7:Error>



  • 2.  Re: RESTMAN error Unsupported Media Type when using curl
    Best Answer

    Broadcom Employee
    Posted Oct 17, 2016 07:03 PM

    It seems RESTMAN doesn't have an endpoint of /folders/bundle, could you double check,

    https://<your gateway>:8443/restman/1.0/doc/restDoc.html#1.0/folders



  • 3.  Re: RESTMAN error Unsupported Media Type when using curl

    Posted Oct 18, 2016 11:06 AM

    Thanks Zhijun!  That was one problem, another was that I needed double rather than single quotes around the Content-Type bit.  This works (from a Mac, FWIW):

     

    curl -u admin:mypassword -X PUT -k -H "Content-Type:application/xml" -d @bundleVoonair.xml -D - https://explore.apim.ca:8443/restman/1.0/bundle