Class Contentstack
- java.lang.Object
-
- com.contentstack.sdk.Contentstack
-
public class Contentstack extends Object
The Content Delivery API is used to retrieve content from your Contentstack account and deliver it to your web or mobile properties. If you are looking for APIs to manage content, you should use the Content Management APIOur APIs serve content via a powerful and robust content delivery network (CDN). Multiple datacenters around the world store a cached copy of your content. When a page request is made, the content is delivered to the user from the nearest server. This greatly accelerates content delivery and reduces latency.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetContentstackEndpoint(String region, String service)Returns the Contentstack API URL for the given region and service.static StringgetContentstackEndpoint(String region, String service, boolean omitHttps)Returns the Contentstack API URL for the given region and service, optionally stripping thehttps://scheme.static Map<String,String>getContentstackEndpoints(String region)Returns all service endpoints for the given region as an ordered map of service key to URL.static Map<String,String>getContentstackEndpoints(String region, boolean omitHttps)Returns all service endpoints for the given region, optionally stripping thehttps://scheme from every URL.static Stackstack(String stackApiKey, String deliveryToken, String environment)A stack is a space that stores the content of a project (a web or mobile property).static Stackstack(String stackApiKey, String deliveryToken, String environment, Config config)A stack is a space that stores the content of a project (a web or mobile property).
-
-
-
Method Detail
-
stack
public static Stack stack(String stackApiKey, String deliveryToken, String environment) throws IllegalAccessException
A stack is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.
Authenticates the stack api key of your stack.
Find Your Stack Credentials from Contentstack .- Parameters:
stackApiKey- The API Key is a unique key assigned to each stack.deliveryToken- The Delivery Token is a read-only credential that you can create for different environments of your stackenvironment- the environment for the stack- Returns:
- the stack
- Throws:
IllegalAccessException- the illegal access exceptionExample
{ @Code Stack stack = contentstack.Stack("apiKey", "deliveryToken", "environment"); }
-
stack
public static Stack stack(String stackApiKey, String deliveryToken, String environment, Config config) throws IllegalAccessException
A stack is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.- Parameters:
stackApiKey- The API Key is a unique key assigned to each stack.deliveryToken- The Delivery Token is a read-only credential that you can create for different environments of your stackenvironment- the environment for the stackconfig- the config- Returns:
- the stack
- Throws:
IllegalAccessException- the illegal access exception Example{ @Code Stack stack = contentstack.Stack("apiKey", "deliveryToken", "environment"); }
-
getContentstackEndpoint
public static String getContentstackEndpoint(String region, String service)
Returns the Contentstack API URL for the given region and service.Delegates to
Endpoint.getContentstackEndpoint(String, String)— provided as a convenience so callers can reach endpoint resolution through the same top-level class they use to create stacks.- Parameters:
region- region ID or alias (e.g."na","eu","azure-na")service- service key (e.g."contentDelivery","contentManagement")- Returns:
- full URL including
https://scheme - Throws:
IllegalArgumentException- if the region or service is not recognised
-
getContentstackEndpoint
public static String getContentstackEndpoint(String region, String service, boolean omitHttps)
Returns the Contentstack API URL for the given region and service, optionally stripping thehttps://scheme.- Parameters:
region- region ID or aliasservice- service keyomitHttps- whentrue, returns the bare host withouthttps://- Returns:
- URL or bare host
- Throws:
IllegalArgumentException- if the region or service is not recognised
-
getContentstackEndpoints
public static Map<String,String> getContentstackEndpoints(String region)
Returns all service endpoints for the given region as an ordered map of service key to URL.- Parameters:
region- region ID or alias- Returns:
- map of service key → full URL
- Throws:
IllegalArgumentException- if the region is not recognised
-
getContentstackEndpoints
public static Map<String,String> getContentstackEndpoints(String region, boolean omitHttps)
Returns all service endpoints for the given region, optionally stripping thehttps://scheme from every URL.- Parameters:
region- region ID or aliasomitHttps- whentrue, returns bare hosts withouthttps://- Returns:
- map of service key → URL or bare host
- Throws:
IllegalArgumentException- if the region is not recognised
-
-