ManagementToken
ManagementToken
To authenticate Content Management API (CMA) requests over your stack content, you can use Management Tokens.
update
The "Update management token" request lets you update the details of a management token. You can change the name and description of the token, update the stack-level permissions assigned to the token, and change the expiry date of the token (if set).
| Name | Type | Description |
|---|---|---|
| requestBody (required) | JSONObject | The request body. |
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
Call<ResponseBody> response = managementToken.update(requestBody).execute();
if (response.isSuccessful) {
System.out.println("Response" + response);
}find
The "Get all management tokens" request returns the details of all the management tokens generated in a stack and NOT the actual management tokens.
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
Call<ResponseBody> response = managementToken.find().execute();
if (response.isSuccessful) {
System.out.println("Response" + response);
}fetch
The "Get a single management token" request returns the details of a specific management token generated in a stack and NOT the actual management token.
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
Call<ResponseBody> response = managementToken.fetch().execute();
if (response.isSuccessful) {
System.out.println("Response" + response);
}delete
The Delete management token request deletes a specific management token
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
Call<ResponseBody> response = folder.delete().execute();
if (response.isSuccessful) {
System.out.println("Response" + response);
}create
The "Create management token" request creates a management token in a stack. This token provides you with read-write access to the content of your stack.
| Name | Type | Description |
|---|---|---|
| body (required) | JSONObject | Details of the management token. |
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
Call<ResponseBody> response = managementToken.create(body).execute();
if (response.isSuccessful) {
System.out.println("Response" + response);
}addParam
| Name | Type | Description |
|---|---|---|
| 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();
ManagementToken managementToken = contentstack.stack().managementToken();
managementToken.addParam("key", value);addHeader
Sets header for the request.
| Name | Type | Description |
|---|---|---|
| key (required) | String | Header key for the request. |
| value (required) | Object | Header value for the request. |
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ManagementToken managementToken = contentstack.stack().managementToken();
managementToken.addHeader("key", value);