I am trying to create a SharePoint list view through the SharePoint REST API, with a defined set of columns to be part of the view. The endpoint i am using is below:



URL: https://tenantname.sharepoint.com/sites/SPSite/_api/web/lists/getbytitle('ListName')/views Headers:

'Accept' - 'application/json;odata=verbose' 'Content-Type' - 'application/json;odata=verbose' Body (JSON):



I get a JSON error, since this payload does not seem to be right. Need help in understanding how to create a view with specific fields through the SharePoint REST API.

Thanks, Yesh

1 Answer 1


In the body you should pass CAML Query for attribute "ViewQuery". Reference:https://www.codesharepoint.com/rest-api/create-view-in-sharepoint-using-rest-api

If you don't want to add filter/order in the view. You could just ignore it. For example:

"PersonalView": false,
"ViewType": "HTML"

After you create the view, you could add/remove fields with the endpoint:



Read here for more: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn531433(v=office.15)#viewfieldcollection-resource

  • - Thank you for the response. So, if i have a collection of 5 fields to be added to the view, does that mean i have to iterate through the collection and add one field at a time to the view? Nov 25, 2020 at 16:36
  • Yes, you are right. Nov 26, 2020 at 2:45
  • Got it! Thank you for clarifying this. This helps. Nov 30, 2020 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.