Integration

Get Involved. Join the Conversation.

Topic

    Deepak Rawat
    REST API Response text/html
    Topic posted July 18, 2019 by Deepak Rawat, tagged Integration, Mapping, Orchestration, PaaS, REST 
    60 Views, 4 Comments
    Title:
    REST API Response text/html
    Summary:
    REST API Response text/html
    Content:

    Hi,

     

    I have REST API with POST method when invoked it provides resposne in the json format but the content type of API is text/html.

    In this case, while modelling integration in OIC, the REST connection response if i provide json response and json type it fails during runtime as API content type is text/html.

    during runtime integration fails with error : response is application/json but expected text/html.

    in this case, should i set the REST connection response type as raw and application/octet-stream and then use stage file to read the content of it and process? as this API Response i have to map to subsequent connections in OIC.

     

     

     

     

    Version:
    19.2.1

    Comment

     

    • Deepak Rawat

      I have attached postman screenshot which is after invoking the API and then navigated to headers in the postman.

    • Hemanth Lakkaraju

      Interesting that a rest-api returning html response!! What is the content of the response - html? Or is the content is json but content-type is text/html?

      Yes, you need to specify raw response and handle it using stage.

      • Deepak Rawat

        yes, it is interesting to see this type of  API.

         

        After invocation of API in postman, if i navigate to Headers it shows as text/html.(previous screenshot as given above thread)

        When i invoke API in postman , It shows the response in the format of JSON well formed tags (refer screenshot below). 

         

    • Kumar U S N

      Hi Team,

      we currently have the same scenario but in on-premise. If this issue is resolved, could you please let me know the steps to fix this.

      Thanks,
      Kumar