Share via

Follow-Up: Publish API fails after Site Created

totally_gizmo 96 Reputation points
2023-01-31T01:03:24.3366667+00:00

This is a follow-up to the problem described [here], https://learn.microsoft.com/en-us/answers/questions/1164075/microsoft-graph-api-sharepoint-create-site-api-fai.

Uploading a page is 2 parts. Create and then publish

Fixes were made over the weekend that allow the [Create API], https://learn.microsoft.com/en-us/graph/api/sitepage-create?view=graph-rest-beta, to upload the test data. This portion is now successful.

The Publish API, https://learn.microsoft.com/en-us/graph/api/sitepage-publish?view=graph-rest-beta is supposed to succeed with a 204. Using Postman, the following error is received:


{
    "error": {
        "code": "resourceModified",
        "message": "The resource has changed since the caller last read it; usually an eTag mismatch",
        "innerError": {
            "date": "2023-01-30T20:28:38",
            "request-id": "requestID",
            "client-request-id": "clientRequestID"
        }
    }
}

The message is sent as follows with no content as described by the Publish API:
POST https://graph.microsoft.com/beta/sites/<siteID>/pages/<pageID>/publish

The message is published and visible in the UI. There are no other indicators that the site page publishing effort has failed.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-04-11T03:21:56.9766667+00:00

    Hello totally_gizmo,

    Thanks for reaching out!

    The error message "The resource has changed since the caller last read it; usually an eTag mismatch" typically occurs when you are trying to publish a resource, such as a site, using the Microsoft Graph API, but the resource has been modified by another process or user since you last retrieved it.

    If you are encountering the "eTag mismatch" error, it means that the ETag value you provided in the request headers does not match the current ETag value of the resource, indicating that the resource has been modified by another process or user since you last retrieved it.

    By ensuring that you are using the correct ETag value in your requests and handling concurrent updates appropriately, you should be able to resolve the "eTag mismatch" error when trying to publish a resource using the Microsoft Graph API.

    Note: APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.