Management Pack Builder

 View Only
Expand all | Collapse all

Brocade - Error code 415: Unsupported Media Type

  • 1.  Brocade - Error code 415: Unsupported Media Type

    Posted Nov 28, 2022 09:55 AM
      |   view attached

    We tried to create MP for Brocade switch. FOS REST API supports the XML (default) and JSON media types.
    For the JSON media type, we have to include in the headers "application/yang-data+json". Unfortunately, Management Pack Builder does not support it and it include by default their media type "application/json" at the end of Accept.

    Maybe somebody know any workaround for this, or how to force MPB to handle "application/yang-data+json" and not append application/json

    Thank you for helping

    Regards

    Marcin 



  • 2.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted Nov 29, 2022 03:54 PM

    Hi Marcin,

    Thanks for finding this issue. We were able to reproduce it and unfortunately we were not able to find a workaround. We will add support for custom Accept values (without appending application/json) in a future release of MP Builder.

    Best regards,

    Mark



  • 3.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Nov 29, 2022 07:51 PM

    Hi Mark,

    Thank you for your answer
    Do you know when next version of MPB will be available.

    Regards

    Marcin



  • 4.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted Nov 30, 2022 02:50 PM

    Hi Marcin,

    We are working on the 1.1 release now and plan on having it done as soon as possible, but we haven't announced a release date yet. We are going to try to add support for custom Accept headers in 1.1.

    Best regards,

    Mark



  • 5.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Feb 08, 2023 02:32 PM

    Hi, any news about new version of MPB. We need it to prepare MP for SAN switches monitoring. 



  • 6.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted Feb 09, 2023 04:59 PM

    Version 1.1 does have this feature in the scope.  We are currently planning an April release date.



  • 7.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted May 08, 2023 01:11 PM

    Management Pack Builder v1.1 has been released and can be downloaded here



  • 8.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Jun 03, 2023 08:54 AM

    Hi.

    I'm using MPB 1.1.0 and I'm getting the same error "Unsupported Media Type" after login request to Brocade. Even if I specify "application/yang-data+json" as Content-Type and Accept label in the header, the Builder ignore them. I see following string in the log:

    [DefaultDispatcher-worker-1] DEBUG ExecLogger [] - -> Accept: application/json; application/yang-data+json; application/yang-data+json.

    Any idea ?



  • 9.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted Jun 06, 2023 05:56 PM

    Hi ,

    We have a workaround which has led to success with other customers for FOS REST API:

    1. In the Source, use basic authentication instead of session (we used running/brocade-chassis/chassis as the API Path, but you can use any working endpoint)

    2. In the Source, set the Accept and Content-Type to "application/yang-data+json" (do not set Accept or Content-Type in individual requests)

    Please let me know if this workaround works for you. If not, please provide screenshots of the Source and Request Accept header configurations.

    Best regards,

    Mark



  • 10.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Jun 13, 2023 06:48 AM
      |   view attached

    Good morning marbogast and sorry for delay !

    Could you please explain what do you mean for "In the Source, set the Accept and Content-Type..." ?

    Please take a look at attached screenshot...Content-Type can not be removed and I already set it as you explained. Are you able to send a screenshot in order to see where exactly you set bot Accept and Content-Type parameters ?

    Thank you very much.

     



  • 11.  RE: Brocade - Error code 415: Unsupported Media Type
    Best Answer

    Broadcom Employee
    Posted Jun 13, 2023 04:18 PM

    Hi , 

    Next step would be to remove the session-based authentication (see no-session.png). Then you can set the headers under Global Request Settings (global-request-settings.png). Finally, set the request path to a working endpoint such as "running/brocade-chassis/chassis" (test-connection-request.png).

    I'll also reach out directly in case it would be easier to set up a meeting.

    Best regards,

    Mark

     



  • 12.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Jun 14, 2023 05:38 AM

    Thank you very much !

    It works and the issue has been solved.



  • 13.  RE: Brocade - Error code 415: Unsupported Media Type

    Posted Jun 24, 2024 12:40 PM
      |   view attached

    Hi galfieri,

    I use post to logging in device , api response headers authorization  Bearer Token.

    How do you request get methods with the Bearer Token?

    Best regards,

    Duncan




  • 14.  RE: Brocade - Error code 415: Unsupported Media Type

    Broadcom Employee
    Posted Jul 09, 2024 01:56 PM

    Duncan,

    These session headers can be set in the source under the global headers.  Specifically for Brocade, you would need to call the login API endpoint and put the Authorization header then under the global headers add that value back.  This will use that session token for all your requests and you will not have to add it to any other configuration section.