API Call Returns Response In HTML Instead Of JSON

API Call 'Get Queue Items' returns HTML response instead of JSON.

When making the following call: GET ​/odata​/QueueItems with $filter on Key, the response body is HTML and not JSON:




   

   

   

   

   

   



   



   UiPath Orchestrator 

   

   
   
   
   
   <link rel="stylesheet" href="/portal_/apollo/packages/apollo-fonts/1/font.css?spaceName=orchestrator" />

   <script type="module" src="/portal_/apollo/packages/portal-shell/2/portal-shell.esm.js?spaceName=orchestrator"></script>
   <ui-app>

       <div class="loader-container">

           <svg class="loader-animation"

                   width="400"

                   height="400"

                   viewBox="0 0 400 400"

                   xmlns="http://www.w3.org/2000/svg">

               <path class="animated-path"

                       d="M32,48H352V368"

                       fill="none"></path>

               <path class="animated-path"

                       d="M368,352H48V32"

                       fill="none"></path>

           </svg>

       </div>



       <span class="material-icons-outlined" style="position:absolute; font-size: .1px; color: transparent">people</span>

   </ui-app>

Root Cause: Most likely there is an issue with the endpoint that is being used, as the issue can be reproduced when misspelling the endpoint - note that the underscore "_" after "orchestrator" is missing.

5.jpg

6.jpg


And when using the correct endpoint:

7.jpg


This has been tested with other endpoints with the same results, for instance:

8.jpg


Resolution:

  • Delete the endpoint and write it by hand or copy it directly from Swagger to make sure there are no encoding issues.

Additional Point:
Verify the input, endpoint, and headers to ensure the output is in JSON format. Any misconfiguration in the input, headers, or endpoint might cause this issue.