No Google results for this error!~
Scenario:
https://mycompany.sharepoint.com/sites/test/_api/web/lists/GetByTitle('my list')/items?$select=Title,Column1,Column2,Column70&$filter=ID ge 1&$top=5000
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
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?!
Solved! Go to Solution.
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...
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...?
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:
This still fails when trying utcnow(now(),-20)...
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:
Questions:
Hi @RezaDorrani , I was using that expression in the screenshot. (Arrow pointing to "Your expression")
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:
Also, I don't have an ID statement in the filter (&$filter=Modified ge '2019-09-09T23:10:19.6357317Z')
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):
This works on lists with <5k records :
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...
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 "&" instead of "&$". I am going to try replacing the &$ with & 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 & notation doesn't fix it, then I'm all out of ideas...
Edit: Unfortunately, replacing &$sortlist with &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 &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....
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
12 | |
9 | |
7 | |
6 | |
4 |
User | Count |
---|---|
19 | |
18 | |
17 | |
9 | |
7 |