I am looking to update my list default view (All Items) using REST API, what i am looking exactly is to show/hide columns.

When i checked the result of this request:

https://m365x873105.sharepoint.com/sites/<Site Name>/_api/web/lists/getByTitle('<List Name>')/views

It appears that there is a certain fields that should be edited in order to update the View, the field are colored in the picture below:

enter image description here

Now i should implement a POST request with the proper Headers in order to update the view, that's my try which is not working:

enter image description here enter image description here enter image description here

What am I missing here ! please.


I just found the answer to my question

there is some endpoints which are useful to edit, i get to manage my issue by removing all the fields with one request, then add every single field i want it to appear in the default view one by one. please go refer to the following links:

Remove All fields

Add field

Move field to

Fortunately i found these endpoints.


get your view : /_api/web/lists/getByTitle('Pages')/Views/getByTitle('test')

and set it to default view

function UpdateList(){ var listName="Pages"; var list = { "__metadata": { "type": 'SP.View' }, "DefaultView": true };

    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('Pages')/Views/getByTitle('test')",
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(list),
    headers: {
        "Accept": "application/json;odata=verbose",
        "X-RequestDigest": jq("#__REQUESTDIGEST").val(),
        "X-HTTP-Method": "MERGE",
        "If-Match": "*"
    success: function (data) {
    error: function (data) {

} UpdateList();

  • Hello Frederic, this will only set the selected view as default, doesn't it ? – AIMEN BOULAHIA Nov 21 '19 at 14:25
  • Hello Aimen, yes, it's ok on my SP2016 – FredericDietrich Nov 21 '19 at 14:47
  • That's not what i am looking for, i said i want to update this default view by showing and hiding columns – AIMEN BOULAHIA Nov 22 '19 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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