Entry

View as Markdown

Entry

An initializer is responsible for creating Entry object.
NameTypeDescription
uid (required)String

Returns the value of attribute uid.

content_type String

Returns the value of attribute content_type.

fields Object

Returns the value of attribute fields.

query Object

Returns the value of attribute query.

get

Get value for field uid

NameTypeDescription
field_uidsString

Field uid for which value to be get.

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_reference('category')

	.fetch;

@entry.get("field_uid");

only

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

NameTypeDescription
fieldsArray

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

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.only(['title', 'description'])

	.fetch;
NameTypeDescription
fieldsString

Reference field uid for which fields to be included

fields_with_baseArray

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

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")	

	.only('category', ['title', 'description'])

	.fetch;

except

Specifies list of field uids that would be 'excluded' from the response.

NameTypeDescription
fieldsArray

Array of the 'only' reference keys to be excluded in response.

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.except(['title', 'description'])

	.fetch;
NameTypeDescription
fieldsString

Reference field uid for which fields to be excluded

fields_with_baseArray

Array of the 'only' reference keys to be excluded in response.

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.except('category', ['title', 'description'])

	.fetch;

include_content_type

Include object's content_type in response

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_content_type

	.fetch;

include_reference

Add a constraint that requires a particular reference key details.

NameTypeDescription
reference_field_uidsstring

Pass reference field that must be included in the response

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_reference('category')

	.fetch;
NameTypeDescription
reference_field_uidsArray
Pass array of reference fields that must be included in the response

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_reference(['category', 'review'])

	.fetch;

include_fallback

Include the fallback locale publish content, if specified locale content is not publish.

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_fallback

	.fetch;

include_branch

Include the branch for publish content.

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_branch

	.fetch;

include_embedded_items

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

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid")

	.include_embedded_items

	.fetch;

fetch

Fetches the latest version of the entries from Contentstack.io content stack

require "contentstack";


@stack = Contentstack::Client.new("api_key", "delivery_token", "environment");

@entry = @stack.content_type("content_type_uid").entry("entry_uid").fetch;