Entry

View as Markdown

Entry

An initializer is responsible for creating Entry object.

NameTypeDescription
uid NSString

Readonly property to check value of entry’s uid

deleted BOOL

Readonly property to check if entry is deleted.

tags NSArray<NSString*>

Readonly property to check tags of entry



contentTypeName NSString

Readonly property to check ContentType name of entry



title NSString

Readonly property to check title of entry.



url NSString

Readonly property to check url of entry.



locale NSString

Readonly property to check Language of entry

createdAt NSDate

Readonly property to check createAt of entry

createdBy NSString

Readonly property to check createdBy of entry

updatedAt NSDate

Readonly property to check updatedAt of entry

updatedBy NSString

Readonly property to check updatedBy of entry

deletedAt NSDate

Readonly property to check deletedAt of entry

deletedBy NSString

Readonly property to check deletedBy of entry

cachePolicy CachePolicy

The property to assign cache policy like CACHE_THEN_NETWORK, NETWORK_ELSE_CACHE, NETWORK_ONLY, etc.

properties NSDictionary<NSString*id>

Readonly property to get data of entry.

setHeader:forKey:

Set a header for Entry

NameTypeDescription
headerValue (required)NSString

The header value

headerKey (required)NSString

The header key

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry setHeader:@"MyValue" forKey:@"My-Custom-Header"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.setHeader("MyValue", forKey: "My-Custom-Header")

addHeadersWithDictionary:

Set a header for Entry

NameTypeDescription
headers (required)NSDictionary<NSString*,NSString*>

The headers as dictionary which needs to be added to the application.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry addHeadersWithDictionary:@{@"My-Custom-Header": @"MyValue"}];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.addHeadersWithDictionary(["My-Custom-Header":"MyValue"])

removeHeaderForKey:

Removes a header from this Entry.

NameTypeDescription
headerKey (required)NSString

The header key that needs to be removed.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" <span>environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry removeHeaderForKey:@"key"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.removeHeaderForKey("key")

configureWithDictionary:

Configure user properties with built object info.

NameTypeDescription
dictionary (required)NSDictionary<NSString*,id*>

The as dictionary which needs to be added to the application.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry configureWithDictionary:@{@"key_name":@"MyValue"}];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

var hashKey:Bool = entry.hasKey("key")

entry.configureWithDictionary(["key_name":"MyValue"])

hasKey:

Checks whether an entry has a given property.

NameTypeDescription
key (required)NSString

The property to be checked

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

BOOL hashKey = [entry hasKey:@"key"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

var hashKey:Bool = entry.hasKey("key")

assetForKey:

Get the info of the specified key of Asset object and returns instance of Assets.

NameTypeDescription
key (required)NSString

Key containing the reference value of Asset

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

Asset *asset = [entry assetForKey:@"asset"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

let asset = entry.assetForKey("asset")

assetsForKey:

Get the array containing instance of Assets mentioned in key specified.

NameTypeDescription
key (required)NSString

Key containing the colection reference value of Assets.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

NSArray *assetArray = [entry assetsForKey:@"asset"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

let assetArray = entry.assetsForKey("asset")

groupForKey:

Get the info of the specified key of Group object and returns instance of Group.

NameTypeDescription
key (required)NSString

Key containing the value of Group

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

Group *detailsGroup = [entry groupForKey:@"details"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

let detailsGroup = entry.groupForKey("details")

groupsForKey:

Get the info of the specified key of content type and returns array of Group.

NameTypeDescription
key (required)NSString

Key containing the value of Group array

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry groupsForKey:@"addresses"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.groupsForKey("addresses")

HTMLStringForMarkdownKey:

Converts Markdown to String of HTML String for specified key

NameTypeDescription
key (required)NSString

Key is Multiple Markdown Parameter

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry HTMLStringForMarkdownKey:@"multiple_markdown"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.HTMLStringForMarkdownKey("Multiple_markdown")

HTMLArrayForMarkdownKey:

Converts Markdown to Array of HTML String for specified key.

NameTypeDescription
key (required)NSString

Key is Multiple Markdown Parameter

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry HTMLArrayForMarkdownKey:@"multiple_markdown"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.HTMLArrayForMarkdownKey("Multiple_markdown")

includeSchema

This method also includes the schema for the entries returned in the response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeSchema];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeSchema()

includeContentType

This method also includes the contenttype for the entries returned in the response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeContentType];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeContentType()

includeFallback

Retrieve the published content of the fallback locale entry if the entry is not localized in specified locale.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeFallback];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeFallback()

includeBranch

Retrieve the branch for the published content.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeBranch];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeBranch()

includeReferenceContentTypeUid

This method also includes the content type UIDs of the referenced entries returned in the response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeReferenceContentTypeUid];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeReferenceContentTypeUid()

includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeEmbeddedItems];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeEmbeddedItems()

includeOnlyFields:

Specifies an array of ‘only’ keys in BASE object that would be included in the response.

NameTypeDescription
fieldUIDs (required)NSArray

Array of the ‘only’ keys to be included in response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeOnlyFields:@["name"]];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeOnlyFields(["name"])

includeAllFieldsExcept:

Specifies an array of keys in reference class object that would be ‘excluded’ from the response.

NameTypeDescription
fieldUIDs (required)NSArray

Array of keys to be excluded from the response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeAllFieldsExcept:@["name"]];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeAllFieldsExcept(["name"])

includeRefFieldWithKey:

Include reference objects with given key in response.

NameTypeDescription
key (required)NSArray

Array of reference keys to include in response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry includeRefFieldWithKey:@[@"detail"]];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeRefFieldWithKey(["detail"])

includeRefFieldWithKey:andOnlyRefValuesWithKeys:

Specifies an array of ‘only’ keys in reference class object that would be included in the response.

NameTypeDescription
key (required)NSString

Key who has reference to some other class object.

values (required)NSArray

Array of the ‘only’ reference keys to be included in response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack  contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry* entry = [contentType  entryWithUID:@"ENTRY_UID"];

[entry includeRefFieldWithKey:@[@"detail"] andOnlyRefValuesWithKeys:@[@"description"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeRefFieldWithKey(["detail"], andOnlyRefValuesWithKeys:["description"])

includeRefFieldWithKey:excludingRefValuesWithKeys:

Specifies an array of keys in reference class object that would be ‘excluded’ from the response.

NameTypeDescription
key (required)NSString

Key who has reference to some other class object.

values (required)NSArray

Array of the ‘only’ reference keys to be ‘excluded’ from the response.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry* entry = [stack includeRefFieldWithKey:@[@"detail"] excludingRefValuesWithKeys:@[@"description"];

[entry addParamKey:@"key" andValue:@"value"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.includeRefFieldWithKey(["detail"], excludingRefValuesWithKeys:["description"])

addParamKey:andValue:

This method adds key and value to an Entry.

NameTypeDescription
key (required)NSString

The key as string which needs to be added to an Entry

value (required)NSString

The value as string which needs to be added to an Entry

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry* entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry addParamKey:@"key" andValue:@"value"];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")

var entry: Entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.addParamKey("key", andValue:"value")

fetch:

Fetches an entry asynchronously provided entry UID.

NameTypeDescription
completionBlock (required)(void ( ^ ) ( ResponseType type , NSError *BUILT_NULLABLE_P error ))

Block to be called once operation is done.

Obj-C

Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];

ContentType *contentType = [stack contentTypeWithName:@"CONTENT_TYPE_UID"];

Entry * entry = [contentType entryWithUID:@"ENTRY_UID"];

[entry fetch:^(ResponseType type, NSError *error) 


}];

Swift

let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")


let entry = stack.contentTypeWithName("CONTENT_TYPE_UID").entryWithUID("ENTRY_UID")

entry.fetch({ (responseType, error!) ->  in


})

Variants

The variants method retrieves details of a specific entry variant or an array of entry variants based on the applied query.

NameTypeDescription
variantUid/variantAlias | variantUids/variantAliases (required)NSString | NSArray

Enter the UID of the variant

Example 1:

#import <Contentstack/Contentstack.h>;


Stack* stack = [Contentstack stackWithAPIKey:<api_key> accessToken:<delivery_token> environmentName:<env_name>];


ContentType* ct = [stack contentTypeWithName:<ct_uid>];

Entry* entry = [ct entryWithUid:<entry_uid>];

[entry variantUid:<variant_uid/variant-alias>];


[entry fetch:^(ResponseType type, NSError *error) {

  if(error) {

    // catch error

  } else {

    // get response

  }

}];

Example 2:

#import <Contentstack/Contentstack.h>;


Stack* stack = [Contentstack stackWithAPIKey:<api_key> accessToken:<delivery_token> environmentName:<env_name>];


ContentType* ct = [stack contentTypeWithName:<ct_uid>];

Entry* entry = [ct entryWithUid:<entry_uid>];

[entry variantUids/variantAliases:[@"variantUid1/variantAlias1", @"variantUid2/variantAlias2",@"variantUid3/variantAlias3"]];


[entry fetch:^(ResponseType type, NSError *error) {

  if(error) {

    // catch error

  } else {

    // get response

  }

}];