cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

SEND HTTP REQUEST TO SHAREPOINT: "Missing URI Parameter"?

No Google results for this error!~

image.png

Scenario:

  • Send an HTTP request to Sharepoint action
    • Works great in the following circumstance:
      • Select 70 columns by name
      • Filter where ID is greater than or equal to 1
      • Bring back the top 5000 records
    • https://mycompany.sharepoint.com/sites/test/_api/web/lists/GetByTitle('my list')/items?$select=Title,Column1,Column2,Column70&$filter=ID ge 1&$top=5000
    • image.png
    • Does NOT work great (Fails with error) when the query is changed like so:
    • https://mycompany.sharepoint.com/sites/test/_api/web/lists/GetByTitle('my list')/items?$select=Title,Column1,Column2,Column70&$filter=Modified ge variables('varDateTime')&$top=5000
    • image.png
    • image.png
Error:
{
"message": "Uri parameter missing\r\nclientRequestId: 89c0710f-3007-4154-b28c-80a179168212",
"status": 400,
"source": "sharepointonline-eus.azconn-eus.p.azurewebsites.net"
}
Tried so far: All failed
  • Hardcoded: 2019-09-18T22:42:04.6462931Z and '2019-09-18T22:42:04.6462931Z'
  • Expression: formatDateTime(body('Get_past_time')) and formatDateTime(body('Get_past_time'), 'yyyy-mm-ddThh:mm:ss')

The WEIRD part of this is: When I remove a bunch of the 70+ columns, the query executes EXCEPT... it returns XML instead of JSON!!

Gosh... whats going on?!

 
1 ACCEPTED SOLUTION

Accepted Solutions

More findings: 

- "400 Missing URI" error required me to formatDateTime to the SAME "friendly" format as the Sharepoint Modified column (MMMM dd, yyyy) for 2 of the lists

- "502 threshold" error required me to index the Modified column

- "401 unauthorized" error required me to formatDateTime to 'yyyy-MM-dd' for 2 of the lists AND to serialize the $select statement. 

  - Previously it was a variable set to:

Title,
Column2, 
Column3, 
ColumnN

  - This was adding extra linebreak characters to the URL when URL-encoded

- Changed it to a variable set to: 

Title,Column2,Column3,ColumnN

  - With no spaces or line breaks to URL-encode.

  - IF there is a max char count for URL's, I'm under it now even with 89 columns!

Wow! That was an effort...

View solution in original post

15 REPLIES 15
ericonline
Community Champion
Community Champion

I even diffed the "Peek code" on the HTTP calls and all the variables...its basically just the changes in filter query (which I hold in two variables "varQueryFull" and "varQueryDelta").

Could not find anything that stands out...It must be something to do with filtering with a datetimestamp...?

image.png

Hi @ericonline 

 

Just tested this with 

/_api/web/lists/GetByTitle('Orders')/items?$select=Title,abba,Status&$filter=ID ge 1&$top=5000

 

and

/_api/web/lists/GetByTitle('Orders')/items?$select=Title,abba,Status&$filter=ID ge 1 and Created ge '@{addDays(utcNow(),-20)}' &$top=5000

 

both worked

bold part is expressions

 

question for you is - what is your use case/condition for the Created date field?

 

 

 

 

Hello @RezaDorrani , thank you for peeking at this. 

I wonder what is different between our two tests.

This is successful:

image.png

This still fails when trying utcnow(now(),-20)...

image.png

image.png

 

PS: The use case for using the Modified column is to grab deltas from a list. This Flow has two paths, one to grab a full download of records from the lists, the other path only grabs deltas (records which have changed in the last x days).

Hi @ericonline 

 

 

for getting items modified in last x days

Can you just try and directly use the below expression (highlighted in bold) as part of the query itself rather than reading it from a variable

 

/_api/web/lists/GetByTitle('Orders')/items?$select=Title,abba,Status&$filter=ID ge 1 and Modified ge '@{addDays(utcNow(),-20)}' &$top=5000

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Boom! Found the issue. Please test this if you can to confirm. And if anyone knows a workaround, I'd much appreciate.

Steps to reproduce:

  • Send an HTTP request to Sharepoint
    • _api/web/lists/GetByTitle('yourTableName')/items?$select=you, need, 32, columns, to, test&$filter=Modified ge '2019-09-09T23:10:19.6357317Z'
    • This will fail
    • Change the $select to 31 columns and it will succeed.

Questions:

  • Why does $select work with 64 columns:
    • _api/web/lists/GetByTitle('yourTableName')/items?$select=feel, free, to, use, all, 60-plus, columns, to, test&$filter=ID ge 1&$top=5000
  • But filtering by Modified $select only works with a max of 31 columns?

Hi @RezaDorrani , I was using that expression in the screenshot. (Arrow pointing to "Your expression")

@ericonline 

 

Test it with 33 columns and works for both so not sure why yours is acting up

 

This worked for me

/_api/web/lists/GetByTitle('Orders')/items?$select=Title,col1,col2,Status,a,b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y,z,cricket,football,tennis,play,pause&$filter=ID ge 1 and Modified ge '2019-09-09T23:10:19.6357317Z'

 

 

Eh... ok, Thank you for testing that.

If its not NUMBER of columns, what about TYPE of columns?

Here are the data types of all 58 columns in this list:

  • 54 Date and time
  • 1 Lookup
  • 2 Person or Group
  • 1 Single line of text

Also, I don't have an ID statement in the filter (&$filter=Modified ge '2019-09-09T23:10:19.6357317Z')

@ericonline 

 

It could be the col types 

Dont think ID makes a difference - I will test

 

@ericonline

 

No problem with dates either

Here is what my action looks like - No issues 

Capture.PNG

 

Thanks for testing @RezaDorrani

Here is the full recap of the issue. One issue still occurring on my end.

This works on lists with >5k records (pulled in 5k batches):

  • _api/web/lists/GetByTitle('tableName')/items?$select=ID&$top=1&$orderby=ID desc
  • _api/web/lists/GetByTitle('tableName')/items?$select=ID&$top=1&$orderby=ID asc
    • Calculate diff, then
  • _api/web/lists/GetByTitle('tableName')/items?$select=all, IDs, you, want&$filter=ID ge <batch1Start>&$top=5000
    • Then continue with batching

This works on lists with <5k records :

  • _api/web/lists/GetByTitle('tableName')/items?$select=up, to, 31, columns, tested&$filter=Modified ge '2019-08-01'
  • Note: I had to Index the Modified column to get around the 502 threshold error
  • STILL GETTING A 401 unauthorized error on two lists 

More findings: 

- "400 Missing URI" error required me to formatDateTime to the SAME "friendly" format as the Sharepoint Modified column (MMMM dd, yyyy) for 2 of the lists

- "502 threshold" error required me to index the Modified column

- "401 unauthorized" error required me to formatDateTime to 'yyyy-MM-dd' for 2 of the lists AND to serialize the $select statement. 

  - Previously it was a variable set to:

Title,
Column2, 
Column3, 
ColumnN

  - This was adding extra linebreak characters to the URL when URL-encoded

- Changed it to a variable set to: 

Title,Column2,Column3,ColumnN

  - With no spaces or line breaks to URL-encode.

  - IF there is a max char count for URL's, I'm under it now even with 89 columns!

Wow! That was an effort...

HEATFreight
Super User
Super User

I'm getting this 400 error:

 

{
  "status": 400,
  "message": "Uri parameter missing\r\nclientRequestId: ...",
  "error": {
    "message": "Uri parameter missing"
  },
  "source": "sharepointonline-...azurewebsites.net"
}

 

(ellipses added for privacy)

I already have this setting configured:


@ericonline wrote:

SAME "friendly" format as the Sharepoint Modified column


I even went so far as indexing the "Modified" column, but I don't think that should be necessary.

I'm noticing that because all the "Modified" column dates are from this year, the format is "MMMM DD" (as in "February 14"), at least when viewed directly in SharePoint, but I don't think that matters. A successful SharePoint REST API query (using Power Automate SharePoint HTTP GET request) returns this format:

 

"Modified": "2022-01-27T19:06:30Z"

 


The only significant difference between this list and my other lists (whose queries are working fine) is that the list with the failing query has 63 columns in the $select= parameter.

The one thing I change in the query that causes it to fail is this:

 

working Uri:
_api/Web/Lists/GetByTitle('ActualListNameGoesHere')/Items?$select=ID,Modified,Title,<63 total columns selected, ignore these carrots>&$filter=Title ne 'Text'&$top=100&

failing Uri:
_api/Web/Lists/GetByTitle('ActualListNameGoesHere')/Items?$select=ID,Modified,Title,<63 total columns selected, ignore these carrots>&$filter=Title ne 'Text'&$top=100&$sortlist='Modified:descending,Title:ascending'&

 


So the Uri parameter that is causing my SharePoint REST API GET request to fail for only one particular list is the "sortlist" parameter. The exact same query works if I simply delete the sortlist part. The exact same query works for 5 other, similar lists.

Note: I added the & symbols at the end of each Uri when testing possible workarounds. Previously I believe adding & at the end of the Uri may have fixed some other bug I was seeing, but it did not work in this case. The working GET list requests all work regardless of the trailing ampersand in the Uri, and the failing GET list request fails regardless of the trailing ampersand in its Uri.

Also, according to this documentation, there is a different Uri notation which uses "&amp;" instead of "&$". I am going to try replacing the &$ with &amp; first just for the sortlist parameter and then for all parameters if that doesn't work. And if replacing every instance of &$ notation in the Uri with &amp; notation doesn't fix it, then I'm all out of ideas...

Edit: Unfortunately, replacing &$sortlist with &amp;sortlist worked in the already-working queries and failed in already-failing query. Also tried using a "Compose" action in the Power Automate flow to encapsulate the Uri then @{outputs('Uri')} dynamic content reference in the Uri input for the SharePoint HTTP action, but that failed as well.

Edit2: I should mention that &amp;orderby= Modified desc& works but I'm trying to sort by at least two columns, so not a complete workaround for me.

Edit3: I do believe there must be some Uri character limit, because by removing a couple more or less extraneous columns, one of which had a fairly long name, I was able to get the request working. But actually I stopped using "sortlist" parameter because I abandoned that query logic for a different one. But I did continue to see errors with that one list query, which pretty much only differed from the others in terms of its really long Uri. And reducing the character count in that Uri has completely resolved the issue... for now! Until some future query creates a condition where the character limit is once again exceeded....

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,380)