Reading Fields

Using the Administration API you can read the fields structure of a content type.

Read All Fields in a Content Type

To get all the fields of a content type see the following code snippet:

public async Task<IEnumerable<Field>> GetFields(Guid applicationId, Guid typeId, string masterKey)
{
    var metadata = new EverliveAccount(new EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
    return await metadata.Application(applicationId).Type(typeId).Fields().GetAll().ExecuteAsync();
}

Read Fields by Filter

By including the X-Everlive-Filter header in the request you can filter the fields.

public async Task<IEnumerable<Field>> GetUserDefinedFields(Guid applicationId, Guid typeId, string masterKey)
{
    var metadata = new EverliveAccount(new EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
    return await metadata.Application(applicationId).Type(typeId).Fields().GetAll().Where(f => f.Kind == ObjectKind.UserDefined).ExecuteAsync();
}

Read a Field by ID

To get the info about a content type field by id use the following code:

public async Task<Field> GetFieldById(Guid applicationId, Guid typeId, Guid fieldId, string masterKey)
{
    var metadata = new EverliveAccount(new EverliveAccountSettings(AuthorizationStrategy.MasterKey, masterKey));
    return await metadata.Application(applicationId).Type(typeId).Fields().GetById(fieldId).ExecuteAsync();
}

See Also


Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.