web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

WebApi call : "Invalid URI: The Uri string is too long.",

(0) ShareShare
ReportReport
Posted on by 5

Hi Team,

We  are having a requirement to processing an Image (64KB,128KB or1 1MB..etc..) through webApi call but we are getting an error "Invalid URI: The Uri string is too long.",

then we referred the below URL:

https://www.c-sharpcorner.com/article/execute-fetchxml-with-webapi-in-dynamics-365-using-javascript/

After tried the above URL approach even though we are getting same below error message.

Now, 64KB image is converted to base64 format and the length of the characters 282000.

We came to know from blog only support limited characters, curently URI string only supports 32768 characters and as the UCI uses a batch, 

Referred blog:

https://community.dynamics.com/365/f/dynamics-365-general-forum/389706/invalid-uri-the-uri-string-is-too-long-issue-while-retrieve-data-using-fetchxml-and-batch-request

We need to achieve the functionality through WebApi call by using fetch XML .. Please anyone can suggest how do we achieve this functionality.

Error Message:

{"Message":"Invalid URI: The Uri string is too long.","ExceptionMessage":"Invalid URI: The Uri string is too long.","ExceptionType":"Microsoft.Crm.CrmHttpException","StackTrace":"   at Microsoft.Crm.Extensibility.OData.CrmODataBatchHandler.<ParseBatchRequestsAsyncImplementationAsync>d__16.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataBatchHandler.<>c__DisplayClass9_0.<<ParseBatchRequestsAsync>b__0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataBatchHandler.<ParseBatchRequestsAsync>d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.OData.Batch.DefaultODataBatchHandler.<ProcessBatchAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Batch.HttpBatchHandler.<SendAsync>d__0.MoveNext()","ErrorCode":"0x0"}

I have the same question (0)
  • Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    I'm afraid this is the limitation as of now.

    You may have to look into alternative, for example, use Organization Service.

    Thanks,

    Wahaj

  • Pankaj Gogoi Profile Picture
    3,177 on at

    Hi,

    Try to reduce the number of attributes from the fetchxml. You can split the base64 and retrieve in multiple API calls if that works for you.

    Good Luck

    Best Regards

    PG

  • rsquarev Profile Picture
    5 on at

    Use batch request to overcome the uri length limitation.

    Here is documentation how to do a batch request. docs.microsoft.com/.../execute-batch-operations-using-web-api

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 156

#2
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans