0

SP 2016 on-prem. I have a test library with bunch of word documents. Calling to part of them return a response like:

{
  "d": {
    "__metadata": {
      "id": "716369bb-3f0e-48fb-845f-d4774d6198ac",
      "uri": "http://sptest/_api/Web/Lists(guid'0161e46c-50ab-4c7d-b098-ff16d3623784')/Items(7)",
      "etag": "\"1\"",
      "type": "SP.Data.Shared_x0020_DocumentsItem"
    },
    "FirstUniqueAncestorSecurableObject": {
      "__deferred": {
        "uri": "http://sptest/_api/Web/Lists(guid'0161e46c-50ab-4c7d-b098-ff16d3623784')/Items(7)/FirstUniqueAncestorSecurableObject"
      }
    },
    "RoleAssignments": {
      "__deferred": {
        "uri": "http://sptest/_api/Web/Lists(guid'0161e46c-50ab-4c7d-b098-ff16d3623784')/Items(7)/RoleAssignments"
      }
    },
    "AttachmentFiles": {
      "__deferred": {
        "uri": uri
      }
    },
    "ContentType": {
      "__deferred": {
        "uri": uri
      }
    },
    "GetDlpPolicyTip": {
      "__deferred": {
        "uri": uri
      }
    },
    "FieldValuesAsHtml": {
      "__deferred": {
        "uri": uri
      }
    },
    "FieldValuesAsText": {
      "__deferred": {
        "uri": uri
      }
    },
    "FieldValuesForEdit": {
      "__deferred": {
        "uri": "http://sptest/_api/Web/Lists(guid'0161e46c-50ab-4c7d-b098-ff16d3623784')/Items(7)/FieldValuesForEdit"
      }
    },
    "File": {
      "__deferred": {
        "uri": uri
      }
    },
    "Folder": {
      "__deferred": {
        "uri": uri
      }
    },
    "ParentList": {
      "__deferred": {
        "uri": uri
      }
    },
    "FileSystemObjectType": 0,
    "Id": 7,
    "ContentTypeId": "0x0101003563CADD50FAD7458CC556B82DE76824",
    "Title": null,
    "SharedWithUsersId": null,
    "A": null,
    "ID": 7,
    "Created": "2018-01-19T11:27:17Z",
    "AuthorId": 1,
    "Modified": "2018-01-19T11:27:17Z",
    "EditorId": 1,
    "OData__CopySource": null,
    "CheckoutUserId": null,
    "OData__UIVersionString": "1.0",
    "GUID": "18de94b1-25d2-4bc6-9218-4c7ac04fcc58"
  }
}

The other returns no d-object just something like:

{
 "odata.metadata": "http://sptest/_api/$metadata#SP.ListData.Shared_x0020_DocumentsItems/@Element",
  "odata.type": "SP.Data.Shared_x0020_DocumentsItem",
  "odata.id": "7948157f-bd75-4be3-a138-31b03df1ec86",
  "odata.etag": "\"2\"",
  "odata.editLink": "Web/Lists(guid'0161e46c-50ab-4c7d-b098-ff16d3623784')/Items(5)",
  "FileSystemObjectType": 0,
  "Id": 5,
  "ContentTypeId": "0x0101003563CADD50FAD7458CC556B82DE76824",
  "Title": null,
  "SharedWithUsersId": null,
  "A": false,
  "ID": 5,
  "Created": "2018-01-19T11:27:15Z",
  "AuthorId": 1,
  "Modified": "2018-02-25T10:08:48Z",
  "EditorId": 1,
  "OData__CopySource": null,
  "CheckoutUserId": null,
  "OData__UIVersionString": "2.0",
  "GUID": "fb980029-1420-41c1-8ab4-326dbd05828a"
}

And i have no idea why. What could cause this? I need to iterate over RoleAssignments of d of any selected item but somewhy this property is missing like the whole d-object.

4

It seems that you are not sending the same Accept header in all GET requests.

You can set Accept header to:

  • application/json (your second response)
  • application/json;odata=nometadata
  • application/json;odata=verbose (your first response)
8
  • I was just typing this. – Ken Hansen Feb 27 '18 at 19:49
  • Hi, Lukáš ! Well, i'm sending the same call for all of items - function do this for me. Playing with YARC! gives the same result, headers are always the same. BTW i've tried "odata=nometadata" with call to item with ID=9, still it returns d-object unlike item with ID=5. Mystery. – Dadudki Feb 28 '18 at 8:19
  • @Dadudki What is the difference between those two items? They are in the same library? Same document type? Permissions set the same? Checked Out status? What URL are you queriing? – Lukas Nespor Feb 28 '18 at 11:11
  • No difference actually. They are just bunch of old docs in the test farm. Permission, checkout status - all the same. Only one of them has a version higher than 1.0. – Dadudki Feb 28 '18 at 15:20
  • Query URL is very simple - sptest/_api/web/lists/getbytitle('Documents')/items(x), only x is a variable. – Dadudki Feb 28 '18 at 15:41

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.