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

Notifications

Announcements

No record found.

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,321 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 46 Most Valuable Professional

#2
Pallavi Phade Profile Picture

Pallavi Phade 33

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 28 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans