SPFX React Updating Document Library file metadata using Rest API 404 issue RRS feed

  • Question

  • I have the item ID for that particular file, but getting 404 issue. Here is the sample code which have been using:`${url}`,
        headers: {
          "Accept": "application/json; odata=verbose",
          'content-type': 'application/json;odata=verbose',
          "X-RequestDigest": requestDigest,
          "X-Http-Method": "MERGE",
          "If-Match": "*"
        body: JSON.stringify({
          "__metadata": { "type": "SP.Data.10Q_x0020_and_x0020_10K_x0020_Filing_x0020_UnzippedItem" },
          "Title": titleLinkUrl
      .then((response: SPHttpClientResponse): void => {
      }).catch(error => {
    Anyone can help me resolve this or provide some demo ?
    Wednesday, December 4, 2019 5:18 AM


  • Hi zimi,

    Please refer the follow code to update a list item based on Item Id, 404 means the Item Id is invalid, please check the Item Id in library firstly:

    Private updateItem() {
      var posturl = this.props.context.pageContext.web.absoluteUrl + `/_api/web/lists/GetByTitle('doc2')/items(10)`;
      var payload = JSON.stringify({
        "__metadata": {
          "type": "SP.Data.Doc2Item"
        "Title": "UpdatedTitle"
      var option = {
        headers: {
          'IF-MATCH': '*',
          'Content-type': 'application/json;odata=verbose',
          "accept": "application/json;odata=verbose",
          'X-HTTP-Method': 'PATCH'
        body: payload
      return, SPHttpClient.configurations.v1, option).then((response: SPHttpClientResponse) => {
        alert(response.status + ':' + response.ok);


    Best Regards

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, December 4, 2019 8:45 AM