Forum Discussion
Rest API - Fetch Data using POST method and CamlQuery and Lookup Column
- Sep 07, 2018
I got the solution. I used the POST method to fetch data from the list
My actual query is around 384 characters long.
I think this post can be helpful to anyone who is seeking a solution using the POST method and without the character limit.
When using $expand all the lookup columns must expand using FieldValuesAsText/ColumnName.https://contoso.sharpeoint.com/_api/web/lists/GetByTitle('JourneyDetails')/GetItems?$select=*,FieldValuesAsText/YourName,FieldValuesAsText/Author&$expand=FieldValuesAsText&$filter=SupervisorApprovalStatus eq 'Approved' and TravelDepartmentApprovalStatus ne 'Approved' and TravelDepartmentApprovalStatus ne 'Rejected'
I want to use filter as well
I have 2 more fields. Where I need condition like below
$filer= (SuprvisorResponse eq 'Approved') and ((DepartmenResponse ne 'Approved') or (DepartmenResponse ne 'Rejected')))
Problem for me is that when I build query it goes beyond 260 characters limit. I am using Sharepoint Online and there is possibility that I need to add one more filter.
So problem is getting bigger and bigger.
So I want solution where there is no limitation for this.
If you have any workaround please let me know.
And thank you for earlier reply but it isn't much helpful.
I got the solution. I used the POST method to fetch data from the list
My actual query is around 384 characters long.
I think this post can be helpful to anyone who is seeking a solution using the POST method and without the character limit.
When using $expand all the lookup columns must expand using FieldValuesAsText/ColumnName.
https://contoso.sharpeoint.com/_api/web/lists/GetByTitle('JourneyDetails')/GetItems?$select=*,FieldValuesAsText/YourName,FieldValuesAsText/Author&$expand=FieldValuesAsText&$filter=SupervisorApprovalStatus eq 'Approved' and TravelDepartmentApprovalStatus ne 'Approved' and TravelDepartmentApprovalStatus ne 'Rejected'
- Rishi GuptaSep 07, 2018Brass Contributor
Yes, POST can be used instead of GET and query can be as long as possible. I have used it in my previous project. Sorry for late response. Thanks!