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

Removes header from the stack using headerKey

NameTypeDescription
headerKey (required)String

The key of the header

import com.contentstack.sdk.*;


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

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

contentType.removeHeader(headerKey)

entry

An Entry is the actual piece of content created using one of the defined content types.

NameTypeDescription
entryUid (required)String

The entry unique ID of the entry that you want to fetch

import contentstack;


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

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

Call<ResponseBody> response = contentType.entry("entryUid").execute();

if (response.isSuccessful) { 

	System.out.println(<"Response"> + response)

}

query

Provides query instance

import com.contentstack.sdk.*;


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

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

contentType.query()

fetch

fetch 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(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();

}

});