after check in a file using rest api , it having approval status as 'draft', do we have any rest api url (postman) to update approval status of a file in share point.



https://<org>.sharepoint.com/sites/dev/_api/web/lists/getByTitle('list title')/items(<item id>)


    "__metadata": {
        "type": "SP.Data.ClientsListItem" // your might be different
    "OData__ModerationStatus": 0,
    "OData__ModerationComments": "Approved by <user name>"

To find out your list's type you can issue http get to https://<org>.sharepoint.com/sites/dev/_api/web/lists/getByTitle('<list title>')?$select=ListItemEntityTypeFullName. You should also provide x-requestdigest in http headers, since it's POST request.

or change moderation status with pnpjs library:

            'OData__ModerationStatus' : 0, // 1 - rejected
            'OData__ModerationComments': `Approved by <user name>`
}).then(data => {
  • Sergei => I am trying to update using Java (Rest API) – Anurag_BEHS Nov 20 '18 at 17:50
  • Then just ignore the part about pnpjs :). I've added just for future reference if somebody uses javascript. – Sergei Sergeev Nov 20 '18 at 17:54
  • Thanks Sergei it works . I have just added one more answer with screen sort and my findings. Hope it will help some one. – Anurag_BEHS Nov 22 '18 at 14:56

As told by Sergei Sergeev. We can change approval status of a file using Rest.
1. post request header.
We need all these parameters in header. (if access token have fullControl as permission then we even don't need x-requestdigest in header)

Accept: application/json;odata=verbose
Authorization: Bearer <Your access token> 
Content-Type: application/json;odata=verbose
If-Match: *

enter image description here

2. post request body enter image description here

As you can see i got response as 204 - that's success. so after post above post request check your share point site.

  • BTW if you use bearer tokens, then you don't need request digest at all. – Sergei Sergeev Nov 23 '18 at 17:11

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.