Environment

View as Markdown

Environment

A publishing environment corresponds to one or more deployment servers or a content delivery destination where the entries need to be published.

update

The "Update environment" call will update the details of an existing publishing environment for a stack.

When executing the API call, under the 'Header' section, you need to enter the API key of your stack and the authtoken that you receive after logging into your account.

NameTypeDescription
requestBody (required)JSONObject

The request body.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

Call<ResponseBody> response = environment.update(requestBody).execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

removeParam

Set header for the request.

NameTypeDescription
key (required)String

Removes query parameters using the key of the request.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

environment.removeParam("key");

find

The "Get all environments" call fetches the list of all environments available in a stack.

You can add queries to extend the functionality of this API call.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

Call<ResponseBody> response = environment.find().execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

fetch

The "Get a single environment" call returns more details about the specified environment of a stack.

When executing the API call, under the 'Header' section, you need to enter the authtoken that you receive after logging into your account.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

Call<ResponseBody> response = environment.fetch().execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

delete

"Delete environment" call will delete an existing publishing environment from your stack.

When executing the API call, under the 'Header' section, you need to enter the API key of your stack and the authtoken that you receive after logging into your account.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

Call<ResponseBody> response = environment.delete().execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

create

The "Add an environment call" will add a publishing environment for a stack.

When executing the API call, under the 'Header' section, you need to enter the API key of your stack and the authtoken that you receive after logging into your account.

NameTypeDescription
body (required)JSONObject

The request body.

import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

Call<ResponseBody> response = environment.create(body).execute();

if (response.isSuccessful) {

    System.out.println("Response" + response);

}

addParam

Sets header for the request.
NameTypeDescription
key (required)String
Query parameter key for the request.
value (required)Object
Query parameter value for the request.
import contentstack;

Contentstack contentstack = new Contentstack.Builder().build();

Environment environment = contentstack.stack().environment();

environment.addParam("key", value);