DeliveryToken

View as Markdown

DeliveryToken

Delivery tokens provide read-only access to the associated environments, while management tokens provide read-write access to the content of your stack. Use these tokens and the stack API key to make authorized API requests.

delete

The "Delete delivery token" request deletes a specific delivery token.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

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

if (response.isSuccessful) {

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

}

update

The "Update delivery token" request lets you update the details of a delivery token.

In the Request Body, you need to pass the updated details of the delivery token in JSON format. The details include the updated name, description, and/or the environment of the delivery token.

NameTypeDescription
requestBody (required)JSONObject

Thee body should be a JSON Object.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

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

if (response.isSuccessful) {

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

}

create

The Create delivery token request creates a delivery token in the stack.

In the Request Body, you need to pass the details of the delivery token in JSON format. The details include the name, description, and environment of the delivery token.

NameTypeDescription
requestBody (required)JSONObject

The request body to create a delivery token.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

Call<ResponseBody> response = deliveryToken.create(requestBody).execute();

if (response.isSuccessful) {

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

}

find

The "Get all delivery tokens" request returns the details of all the delivery tokens created in a stack.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

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

if (response.isSuccessful) {

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

}

fetch

The "Get a single delivery token" request returns the details of all the delivery tokens created in a stack.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

Call<ResponseBody> response = deliveryToken.fetch().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();

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

deliveryToken.addParam("key", value);

removeParam

Sets header for the request.

NameTypeDescription
key (required)String

Remove query parameters of request by key.

import contentstack;

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

deliveryToken.removeParam("key");

addHeader

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

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

DeliveryToken deliveryToken = contentstack.stack().deliveryToken();

deliveryToken.addHeader("key", value);