4

Say you query a ListItem from the API _api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)

and Let's say the item is a Page, and the Response looks like below.

{
    "d": {
        "__metadata": {
            "id": "ce0f35a3-0644-4346-8819-52ec87d70f91",
            "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)",
            "etag": "\"4\"",
            "type": "SP.Data.SitePagesItem"
        },
        "FirstUniqueAncestorSecurableObject": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/FirstUniqueAncestorSecurableObject"
            }
        },
        "RoleAssignments": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/RoleAssignments"
            }
        },
        "AttachmentFiles": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/AttachmentFiles"
            }
        },
        "ContentType": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/ContentType"
            }
        },
        "FieldValuesAsHtml": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/FieldValuesAsHtml"
            }
        },
        "FieldValuesAsText": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/FieldValuesAsText"
            }
        },
        "FieldValuesForEdit": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/FieldValuesForEdit"
            }
        },
        "File": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/File"
            }
        },
        "Folder": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/Folder"
            }
        },
        "ParentList": {
            "__deferred": {
                "uri": "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/ParentList"
            }
        },
        "FileSystemObjectType": 0,
        "Id": 1,
        "ContentTypeId": "0x01010800A17AD719CAA5FD488DE4BE6975C27838",
        "WikiField": "<div class=\"ExternalClassF6F68F52E1E4476EAC56AA39304E040F\">\r\n            <table id=\"layoutsTable\" style=\"width&#58;100%;\">\r\n                <tbody>\r\n                    <tr style=\"vertical-align&#58;top;\">\r\n            <td colspan=\"2\"><div class=\"ms-rte-layoutszone-outer\" style=\"width&#58;100%;\"><div class=\"ms-rte-layoutszone-inner\" style=\"word-wrap&#58;break-word;margin&#58;0px;border&#58;0px;\"><div class=\"ms-rtestate-read ms-rte-wpbox\"><div class=\"ms-rtestate-read e572e784-7389-4c16-b560-b23a3f5f8c6f\" id=\"div_e572e784-7389-4c16-b560-b23a3f5f8c6f\"></div>\n  <div class=\"ms-rtestate-read\" id=\"vid_e572e784-7389-4c16-b560-b23a3f5f8c6f\" style=\"display&#58;none;\"></div>\n</div>\n</div></div></td>\r\n                    </tr>\r\n                    <tr style=\"vertical-align&#58;top;\">\r\n            <td style=\"width&#58;49.95%;\"><div class=\"ms-rte-layoutszone-outer\" style=\"width&#58;100%;\"><div class=\"ms-rte-layoutszone-inner\" style=\"word-wrap&#58;break-word;margin&#58;0px;border&#58;0px;\"><div class=\"ms-rtestate-read ms-rte-wpbox\"><div class=\"ms-rtestate-read 37952ec8-18c0-480f-9427-98988341f8e7\" id=\"div_37952ec8-18c0-480f-9427-98988341f8e7\"></div>\n  <div class=\"ms-rtestate-read\" id=\"vid_37952ec8-18c0-480f-9427-98988341f8e7\" style=\"display&#58;none;\"></div>\n</div>\n</div></div></td>\r\n            <td class=\"ms-wiki-columnSpacing\" style=\"width&#58;49.95%;\"><div class=\"ms-rte-layoutszone-outer\" style=\"width&#58;100%;\"><div class=\"ms-rte-layoutszone-inner\" style=\"word-wrap&#58;break-word;margin&#58;0px;border&#58;0px;\"><div class=\"ms-rtestate-read ms-rte-wpbox\"><div class=\"ms-rtestate-read 0f00075e-2352-43d8-8477-f2fb51cf2739\" id=\"div_0f00075e-2352-43d8-8477-f2fb51cf2739\"></div>\n  <div class=\"ms-rtestate-read\" id=\"vid_0f00075e-2352-43d8-8477-f2fb51cf2739\" style=\"display&#58;none;\"></div>\n</div>\n</div></div></td>\r\n                    </tr>\r\n                </tbody>\r\n            </table>\r\n            <span id=\"layoutsData\" style=\"display&#58;none;\">true,false,2</span></div>",
        "Title": null,
        "ID": 1,
        "Created": "2014-09-01T05:48:04Z",
        "AuthorId": 1073741823,
        "Modified": "2014-09-01T05:48:18Z",
        "EditorId": 1073741823,
        "OData__CopySource": null,
        "CheckoutUserId": null,
        "OData__UIVersionString": "1.0",
        "GUID": "2f0c04dc-dfa7-4154-8e87-d11d5d91cbf6"
    }
}

I was trying to find document to explain the response structure in the MSDN.

So far I didn't found any read. I try to understand like below .but I am not sure if it is right . Please help to review it .

  1. The ["d"]["__metadata"]["uri"] represents the RestAPI url of request to query the current ListItem?
  2. The ["__deferred"]["uri"] represent the RestAPI url to query other information of ListItem. eg: File url is "https://beyondhard.sharepoint.com/sites/TestPrivate/_api/Web/Lists(guid'c5689c37-a28a-4122-bedb-b2ec7c44204f')/Items(1)/File?
  3. Some of the properties like Created,Id etc can be returned from query. But some of the properties like ContentType need to be query with uri to know the detail.Right ?

Thanks,

Joe

2 Answers 2

10

Please find the comments below:

  1. ["d"]["__metadata"]["uri"] represents the REST Endpoint url of the resource, in your case of List Item resource, e.g. /_api/Web/Lists(guid'<list guid>')/Items(<item id>)
  2. ["__deferred"]["uri"] REST endpoint url of the resource it represents, e.g. /_api/Web/Lists(guid'<list guid>')/Items(<item id>)/File for File resource
  3. See the section below.

Deferred properties in SharePoint REST

Deferred properties (like File for List Item resource) are not retrieved by default (first of all, for performance reasons). There are two options how to retrieve deferred properties:

  • perform a separate request, for example for File resource: /_api/web/lists/getbytitle('<list name>')/items(<item id>)/File
  • utilize $expand query option to request the projected properties. The following example demonstrates how to request List Item with File property initialized:

    /_api/web/lists/getbytitle('[list name]')/items([item id])?$expand=File

What properties could be retrieved using SharePoint REST

Unfortunately SharePoint REST does not support to retrieve some properties like Publishing fields. For example, in your case for Page item, PublishingPageImage property could not be retrieved directly via SharePoint REST.

References

VGR

4
  • +1 I am trying to search it in the MSDN. But didn't found. Please give me some link of it to read. thanks.
    – Joe.wang
    Commented Sep 18, 2014 at 2:09
  • Regarding documentation, you might find this article platinumdogs.me/2013/03/14/… usefull, it describes what fields are exposed via SharePoint REST inteface Commented Sep 18, 2014 at 9:40
  • 1
    Got it, Good Post ,It seems expand,select etc is from OData Specification .Right?
    – Joe.wang
    Commented Sep 18, 2014 at 9:48
  • 1
    That's right, odata.org/documentation/odata-version-2-0 Commented Sep 18, 2014 at 9:52
1

You're correct, if you include the REST method $select you'll get more data for the columns you specify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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