ContentType

View as Markdown

ContentType

Content type defines the structure or schema of a page or a section of your web or mobile property. To create content for your application, you are required to first create a content type, and then create entries using the content type.

removeHeader

The removeHeader method removes a header from the stack by using the specified header key.

NameTypeDescription
headerKey (required)String

The key of the header

import com.contentstack.sdk.*;


Stack stack = Contentstack.stack(context, apiKey, deliveryToken, environment);

ContentType contentType = stack.contentType("contentTypeUid");

contentType.removeHeader(headerKey)

entry

The entry method retrieves a specific entry, which is an actual piece of content created using one of the defined content types.

NameTypeDescription
entryUid (required)String

TThe unique ID of the entry that you want to fetch

import com.contentstack.sdk.*;


Stack stack = Contentstack.stack(context, apiKey, deliveryToken, environment);

ContentType contentType = stack.contentType("contentTypeUid");

contentType.entry("entryUid")

query

The query method returns a query instance for building and executing advanced entry queries on a specified content type.

import com.contentstack.sdk.*;


Stack stack = Contentstack.stack(context, apiKey, deliveryToken, environment);

ContentType contentType = stack.contentType("contentTypeUid");

contentType.query()

fetch

The fetch method retrieves all the content types available for the stack.

NameTypeDescription
params (required)JSONObject

key value parameters of type JSONObject

callback (required)ContentTypesCallback

The callback of type ContentTypesCallback

import com.contentstack.sdk.*;


Stack stack = Contentstack.stack(context, apiKey, deliveryToken, environment);

ContentType contentType = stack.contentType("contentTypeUid");

contentType.fetch(new JSONObject(), new ContentTypesCallback() {

 @Override

public void onCompletion(ContentTypesModel model, Error error) {

   JSONArray resp = model.getResultArray();

}

});