Stack

View as Markdown

Stack

Stack an instance of ContentType, asset, assetQuery, and sync

syncToken

In this API request, you need to provide the sync_token that you received in the last complete sync process. If there are more than 100 records, you will get a pagination_token instead

NameTypeDescription
syncTokenString

sync token fetches only the content that was added after your last sync

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var response = stack.syncToken("syncToken")

sync

The Sync API takes care of syncing your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates.

NameTypeDescription
contentTypeUidString

content type UID. e.g., products This retrieves published entries of specified content type.

fromDateString

Enter the start date. e.g., 2018-08-14T00:00:00.000Z This retrieves published entries starting from a specific date

localeString

Enter locale code. e.g., en-us This retrieves published entries of the specific locale

publishTypePublishType

Applicable values are:

  • entry_published
  • asset_published
  • entry_unpublished
  • asset_unpublished
  • entry_deleted
  • asset_deleted
  • content_type_deleted

If you do not specify any value, it will bring all published entries and published assets.

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var response = stack.sync("contentTypeUid", "fromDate", "locale", PublishType.Entry_Published)

setHost

Adds host for the request

NameTypeDescription
host (required)String

The host for the API url

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

stack.setHost("host")                                                                        </span>

setHeader

adds header using header key and value

NameTypeDescription
key (required)String

The header key

value (required)String

the header value

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

stack.setHeader("headerKey", "headerValue")                                                                        </span>

removeHeader

Remove header using headerKey

NameTypeDescription
headerKey (required)String

The header key

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

stack.removeHeader("headerKey")                                                                        </span>

paginationToken

If the result of the initial sync (or subsequent sync) contains more than 100 records, the response would be paginated. It provides pagination token in the response. However, you do not have to use the pagination token manually to get the next batch, the SDK does that automatically until the sync is complete. Pagination token can be used in case you want to fetch only selected batches. It is especially useful if the sync process is interrupted midway (due to network issues, etc.). In such cases, this token can be used to restart the sync process from where it was interrupted.
NameTypeDescription
paginationToken (required)String

The pagination token

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var response = stack.paginationToken("paginationToken")                                                                        </span>

imageTransform

The Image Delivery API is used to retrieve, manipulate and/or convert image files of your Contentstack account and deliver it to your web or mobile properties.

NameTypeDescription
imageUrl (required)String

Base Image Url of the image you want to manipulate

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var image = stack.


                                                                         </span>

getContentTypes

ContentType accepts contentTypeId in as the parameter

NameTypeDescription
queryParams (required)Map
ContentType accepts query params as parameter                    
import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var contentType = stack.

contentType

ContentType accepts contentTypeId in as the parameter

NameTypeDescription
contentTypeId (required)String
ContentType accepts contentTypeId as the parameter
import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var contentType = stack.contentType("contentTypeId")

assetQuery

It also returns the content of each asset in JSON format.

NameTypeDescription
uid (required)String

Asset uid

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var assets = stack.assetQuery()

asset

This call fetches the latest version of a specific. asset of a particular stack.

NameTypeDescription
uid (required)String

Asset uid

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var asset = stack.asset("uid")

getLivePreview

Live preview of the stack

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var preview = stack.getLivePreview

host

host of the stack

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var host = stack.host

environment

environment of the stack

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var environment = stack.environment

endpoint

endpoint for the api

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var endpoint = stack.endpoint

deliveryToken

delivery token for the stack

import Contentstack


final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");

var deliveryToken = stack.deliveryToken

stack

an instance of the stack

NameTypeDescription
apiKey (required)String

apiKey of the stack

deliveryToken (required)String

Delivery Token for the stack

environment (required)String

Environment of the stack

apiVersionString
apiVersion is version of the API
Default: v3
regionRegion

DB region for your stack. You can choose from six regions namely, NA, EU, Azure NA, Azure EU, GCP NA, and GCP EU.

Default: Region.US
hostString

host of the api

Default: cdn.contentstack.io
livePreviewdict

live preview for the stack

Default: {}
clientBaseClient

Client to make API request

import Contentstack


final stack = contentstack.Stack(apiKey, deliveryToken, environment);

apiKey

apiKey of for the stack

import Contentstack


final stack = contentstack.Stack("

", "

", "

");

var apiKey = stack.apiKey