Reading Fields for a List using REST API SharePoint 2013

We can read the all the fields in a SharePoint list by consuming the REST endpoint:

http://server/_api/lists/getbytitle('listname')/fields

for example, below url retrieves  all the fields in the library(or list) Accounts:

https://xxx.sharepoint.com/_api/lists/getbytitle('Accounts')/fields

Return value: (I have marked in yellow, some of the important noticeable properties).

{
    "d": {
        "results": [
            {
                {
                "__metadata": {
                    "id": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'0953b0e6-65c1-41e8-98da-869f106b0669')",
                    "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'0953b0e6-65c1-41e8-98da-869f106b0669')",
                    "type": "SP.FieldText"
                },
                "DescriptionResource": {
                    "__deferred": {
                        "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'0953b0e6-65c1-41e8-98da-869f106b0669')/DescriptionResource"
                    }
                },
                "TitleResource": {
                    "__deferred": {
                        "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'0953b0e6-65c1-41e8-98da-869f106b0669')/TitleResource"
                    }
                },
                "AutoIndexed": false,
                "CanBeDeleted": true,
                "DefaultValue": null,
                "Description": "",
                "Direction": "none",
                "EnforceUniqueValues": false,
                "EntityPropertyName": "AccountId",
                "Filterable": true,
                "FromBaseType": false,
                "Group": "Custom Columns",
                "Hidden": false,
                "Id": "0953b0e6-65c1-41e8-98da-869f106b0669",
                "Indexed": false,
                "InternalName": "AccountId",
                "JSLink": "clienttemplates.js",
                "ReadOnlyField": false,
                "Required": false,
                "SchemaXml": "<Field Type=\"Text\" DisplayName=\"AccountId\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" MaxLength=\"255\" ID=\"{0953b0e6-65c1-41e8-98da-869f106b0669}\" SourceID=\"{d5f89928-6c33-476d-a80c-54fcf0d57164}\" StaticName=\"AccountId\" Name=\"AccountId\" ColName=\"nvarchar10\" RowOrdinal=\"0\" />",
                "Scope": "/SalesForce Files",
                "Sealed": false,
                "Sortable": true,
                "StaticName": "AccountId",
                "Title": "AccountId",
                "FieldTypeKind": 2,
                "TypeAsString": "Text",
                "TypeDisplayName": "Single line of text",
                "TypeShortDescription": "Single line of text",
                "ValidationFormula": null,
                "ValidationMessage": null,
                "MaxLength": 255
            },
            {
                "__metadata": {
                    "id": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'7d522db6-c085-4161-bbff-d11a538c57a9')",
                    "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'7d522db6-c085-4161-bbff-d11a538c57a9')",
                    "type": "SP.FieldText"
                },
                "DescriptionResource": {
                    "__deferred": {
                        "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'7d522db6-c085-4161-bbff-d11a538c57a9')/DescriptionResource"
                    }
                },
                "TitleResource": {
                    "__deferred": {
                        "uri": "https://xxx.sharepoint.com/_api/Web/Lists(guid'd5f89928-6c33-476d-a80c-54fcf0d57164')/Fields(guid'7d522db6-c085-4161-bbff-d11a538c57a9')/TitleResource"
                    }
                },
                "AutoIndexed": false,
                "CanBeDeleted": true,
                "DefaultValue": null,
                "Description": "",
                "Direction": "none",
                "EnforceUniqueValues": false,
                "EntityPropertyName": "File_x0020_Type0",
                "Filterable": true,
                "FromBaseType": false,
                "Group": "Custom Columns",
                "Hidden": false,
                "Id": "7d522db6-c085-4161-bbff-d11a538c57a9",
                "Indexed": false,
                "InternalName": "File_x0020_Type0",
                "JSLink": "clienttemplates.js",
                "ReadOnlyField": false,
                "Required": false,
                "SchemaXml": "<Field Type=\"Text\" DisplayName=\"File Type\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" MaxLength=\"255\" ID=\"{7d522db6-c085-4161-bbff-d11a538c57a9}\" SourceID=\"{d5f89928-6c33-476d-a80c-54fcf0d57164}\" StaticName=\"File_x0020_Type0\" Name=\"File_x0020_Type0\" ColName=\"nvarchar11\" RowOrdinal=\"0\" Version=\"1\" />",
                "Scope": "/SalesForce Files",
                "Sealed": false,
                "Sortable": true,
                "StaticName": "File_x0020_Type0",
                "Title": "File Type",
                "FieldTypeKind": 2,
                "TypeAsString": "Text",
                "TypeDisplayName": "Single line of text",
                "TypeShortDescription": "Single line of text",
                "ValidationFormula": null,
                "ValidationMessage": null,
                "MaxLength": 255
            },

           . . . . . . .  .

Here as i marked in yellow:

Hidden
false  (Indicates that this field is not system defined and used for internal purpose).
Internal Name
Name of the field as defined internally by SharePoint.
Title
Title of the field.
TypeAsString
Type of the field in text.
FieldTypeKind
Refer below link for possible values:         

Hope it helped you :)

Comments

Popular posts from this blog

SharePoint Online (O365) OAuth Authentication | Authorizing REST API calls against SharePoint Online Site | Get Access token from SharePoint Online | Set up OAuth for SharePoint Online Office 365

SharePoint 2013 REST API Reference

Simple Risk Assessment Matrix table with resultant risk calculation

Kendo UI (Core JavaScript) grid Server Paging, Server Sorting and Server Filtering with Dynamic SQL queries

Sharepoint- Using an Image From formatmap32x32.png in a Ribbon Control