cs-icon.svg

Contentstack Java Marketplace SDK

Introduction to Java Marketplace SDK

Contentstack offers Java Marketplace SDK. Seamlessly integrated, this SDK empowers Java developers to effortlessly build, deploy, and manage marketplace applications. Below is an in-depth guide to initiate your journey with the Java Marketplace SDK.

Additional Resource: To know more about the Java Marketplace SDK, refer to the About Java Marketplace SDK and Get Started with Java Marketplace SDK documentation.

Marketplace

Contentstack Marketplace is a hub for apps and other resources that help you extend the capabilities of our core CMS and customize its functionalities. It houses third-party integrations, UI extensions (such as dashboard, sidebar, custom field, and RTE plugins), and other tools that you can plug into Contentstack at the stack as well as organizational level.

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID").host("marketplace.contentstack.io").region(Region.EU).build();
NomTypeDescription

organizationUid (required)

Chaîne

UID of the org

héberger

Chaîne

A custom host

région

Region.EU

DB region for Stack. You can choose from five regions namely, NA, EU, Azure NA, Azure EU, and GCP NA. The default region is set to NA.

connexion

The login method is an optional method for the user to perform CRUD operations. Alternatively, users can perform CRUD operations directly using an authtoken without logging in.

NomTypeDescription

emailId (required)

Chaîne

Your email id

mot de passe (obligatoire)

Chaîne

Your password

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID").login(“emailId”, “password”).build();

app

The app method creates and retrieves a new instance of the App class with the given parameters.

Retour:
Type
Application
NomTypeDescription

uid

Chaîne

UID of the app

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app("app_uid");

authorizations

The authorizations method retrieves a new instance of the Auth class with the given client and orgId.

Retour:
Type
Auth

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Auth authorizations = marketplace.authorizations();

installation

The installation method retrieves a new instance of the Installation class with the specified client and orgId.

Retour:
Type
Installation
NomTypeDescription

installationId

Chaîne

UID to create a new installation object.

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Auth authorizations = marketplace.installation();

request

The request method retrieves a new instance of the AppRequest class with the specified client and orgId.

Retour:
Type
AppRequest

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
AppRequest request = marketplace.request();

Application

App/Manifest is used for creating/updating/deleting an app in your organization.

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID").host("marketplace.contentstack.io").build(); 
App app = marketplace.app("installationId"); 
(or) App app = marketplace.app();
NomTypeDescription

organizationUid (required)

Chaîne

UID de l'organisation

installationId

Chaîne

UID of the app

addParam

The addParam method adds a header with the specified key and value to the current location and returns the updated location.

Specified by:

addParam in interface BaseImplementation<App>

Retour:
Type
Application
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Throws:

java.lang.NullPointerException - if the key or value argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marktetplace.contentstack.io").build(); 
App app = marketplace.app().addParam("key","value");

addHeader

The addHeader method adds a header with the specified key and value to this location and returns the updated location.

Specified by:

addHeader in interface BaseImplementation<App>

Retour:
Type
Application
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Chaîne

The value of the header to be added

Throws:

java.lang.NullPointerException - if the key or value argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().addHeader("key","value");

addParams

The addParams method adds the specified parameters to this location and returns the updated location.

Specified by:

addParams

Retour:
Type
Application
NomTypeDescription

params (required)

HashMap

The parameters to be added

Throws:

java.lang.NullPointerException - if the params argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
HashMap param = new HashMap(); 
App app = marketplace.app().addParams(param);

addHeaders

The addHeaders method adds the specified parameters to this location and returns the updated location.

Specified by:

addHeaders provides support to add custom header to the request.

Retour:
Type
Application
NomTypeDescription

headers (required)

HashMap

The parameters to be added

Throws:

java.lang.NullPointerException - if the params argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
HashMap param = new HashMap(); 
App app = marketplace.app().addHeaders(param);

createInstallation

The createInstallation method creates an installation call.

Retour:
Type
call
NomTypeDescription

body (required)

JSONObject

The body of the call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
JSONObject body = new JSONObject(); 
App app = marketplace.app().createInstallation(body); 
Call response = app.execute();

updateVersion

The updateVersion method updates the version call.

Retour:
Type
call
NomTypeDescription

body (required)

Chaîne

The body of the call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
JSONObject body = new JSONObject(); 
App app = marketplace.app().updateVersion(body); 
Call response = app.execute();

findAppAuthorizations

The findAppAuthorizations method finds the app authorizations call.

Retour:
Type
call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().findAppAuthorizations(); 
Call response = app.execute();

deleteAuthorization

The deleteAuthorization method deletes the authorization call.

Retour:
Type
call
NomTypeDescription

authorizationUid (required)

Chaîne

UID of the authorization call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("api.contentstack.io").build(); 
App app = marketplace.app().deleteAuthorization("authorizationUid"); 
Call response = app.execute();

findAppInstallations

The findAppInstallations method finds the app installation call.

Retour:
Type
call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().findAppInstallations(); 
Call response = app.execute();

findApps

The findApps method finds the app's call.

Retour:
Type
call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().findApps(); 
Call response = app.execute();

createApp

The createApp method creates an app call.

Retour:
Type
call
NomTypeDescription

body (required)

JSONObject

The body of the call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
JSONObject body = new JSONObject(); 
App app = marketplace.app().createApp(body); 
Call response = app.execute();

fetchApp

The fetchApp method fetches the app call.

Retour:
Type
call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().fetchApp(); 
Call response = app.execute();

updateApp

The updateApp method updates the app call.

Retour:
Type
call
NomTypeDescription

body (required)

JSONObject

The body of the call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
JSONObject body = new JSONObject(); 
App app = marketplace.app().updateApp(); 
Call response = app.execute();

findAppRequests

The findAppRequests method retrieves a call to list app requests with specified headers, app UID, and parameters.

Retour:
Type
call

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
App app = marketplace.app().findAppRequests(); 
Call response = app.execute();

oauth

The oauth method retrieves an instance of oauth

Retour:
Type
oauth
NomTypeDescription

id

Chaîne

The UID of the app

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Oauth oauth = marketplace.app().oauth("id");

hosting

The hosting method retrieves an instance of hosting.

Retour:
Type
hosting
NomTypeDescription

id

Chaîne

The UID of the app

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Hosting hosting = marketplace.app().hosting("appId");

Auth

While authorizing a Contentstack App, the app requests permissions from the user to perform a set of operations on behalf of the user. The app receives an access token after a user authenticates and authorizes access, then passes it as a credential when it calls the Contentstack APIs.

The Auth class handles user-requested permissions, allowing users to either request for the permission or, once their task is finished, request permission revocations.

Exemple :

Auth auth = marketplace.authorizations()
.addParam("param1", "value1")
.addHeader("authtoken", ORG_UID);
NomTypeDescription

organizationUid (required)

Chaîne

UID de l'organisation

findAuthorizedApp

The findAuthorizedApp method returns a call to retrieve authorized apps.

Retour:
Type
call

Exemple :

Call<ResponseBody> request = auth.findAuthorizedApp().execute();

addParam

The addParam method adds a header with the specified key and value

Specified by:

addParam in interface BaseImplementation

Retour:
Type
Auth
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Throws:

NullPointerException - if the key or value argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Auth authorizations = marketplace.authorizations(); 
authorizations.addParam("param1", "value1");

addHeader

The addHeader adds a header with the specified key and value.

Specified by:

addHeader provides support to add custom header to the request

Retour:
Type
Auth
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Throws:

NullPointerException - if the key or value argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Auth authorizations = marketplace.authorizations(); 
authorizations.addHeader("key", "value");

addParams

The addParams method adds the specified parameters.

Specified by:

addParams in interface BaseImplementation

Retour:
Type
Auth
NomTypeDescription

params (required)

HashMap

The parameters to be added

Throws:

NullPointerException - if the params argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Auth authorizations = marketplace.authorizations(); 
HashMap params = new HashMap(); 
authorizations.addParams(params);

addHeaders

The addHeaders method adds the specified parameters.

Specified by:

addHeaders in interface BaseImplementation

Retour:
Type
Auth
NomTypeDescription

headers (required)

HashMap

The parameters to be added

Throws:

NullPointerException - if the params argument is null

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("api.contentstack.io").build(); 
Auth authorizations = marketplace.authorizations(); 
HashMap params = new HashMap(); 
authorizations.addHeaders(params);

Installation

Contentstack Marketplace enables users to directly install prebuilt apps and starters. However, app installations are subject to access restrictions, meaning your ability to view all or certain installed apps depends on the permissions granted at both the stack and organization levels.

  • If you are an organization admin or owner, you will be able to see all the stack and organization apps installed by any user in your organization.
  • If you are a stack admin or owner, you will be able to see the apps installed for the stacks that you have access to.
  • If you are not a stack admin or owner, you will be able to see the apps installed for the stacks that you have access to.

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Installation installation = marketplace.installation();
NomTypeDescription

organizationId (required)

Chaîne

UID de l'organisation

installationId

Chaîne

UID for the installation

validateInstallationId

The validateInstallationId method validates if the installationId is not null or empty.

Retour:
Type
annuler
NomTypeDescription

installationId (required)

Chaîne

UI for the installation

Exemple :

Installation installation = marketplace.installation();
Installation installation = marketplace.installation("installationId");

location

The location method returns a new Location object with the specified client, organisationId, and installationId.

Retour:
Type
location

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Installation installation = marketplace.installation(); 
Call result = installation.location().execute();

webhook

The webhook method creates and returns a new Webhook object with the given parameters.

Retour:
Type
Webhook
NomTypeDescription

webhookId (required)

Chaîne

UID du webhook

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Installation installation = marketplace.installation(); 
JSONObject body = new JSONObject(); 
Call result = installation.webhook("webhookId").execute();

addParam

The addParam method adds a parameter to the collection using a key-value pair.

Specified by:

addParam in interface BaseImplementation

Retour:
Type
Installation
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Installation installation = marketplace.installation().addParam("key", "value");

addParams

The addParams method takes a HashMap of parameters and returns a generic type T.

Specified by:

addParams in interface BaseImplementation

Retour:
Type
Installation
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
HashMap parameters = new HashMap(); 
Installation installation = marketplace.installation().addParams(parameters);

addHeader

The addHeader method adds a header with a specified key and value to a request.

Specified by:

addHeader in interface BaseImplementation

Retour:
Type
Installation
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Chaîne

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
Installation installation = marketplace.installation().addHeader("key", "value");

addHeaders

The addHeaders method takes a HashMap of headers and adds them to the request.

Specified by:

addHeaders provides support to add custom header to the request

Retour:
Type
Installation
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Chaîne

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
HashMap parameters = new HashMap(); 
Installation installation = marketplace.installation().addHeaders(parameters);

AppRequest

If a user does not have the necessary permissions to install an app in an organization or stack, they can request the organization or stack administrator to install the app on their behalf. To do this, the user clicks the Request Install button.

Once the request is made, the organization or stack administrator can then approve or reject the request.

Exemple :

AppRequest appRequest = marketplace.request();
NomTypeDescription

orgId (required)

Chaîne

UID de l'organisation

addParam

The addParam method adds a parameter to a collection using a key-value pair.

Specified by:

addParam in interface BaseImplementation

Retour:
Type
AppRequest
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the given key in the queryParams map

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
AppRequest appRequest = marketplace.request(); 
appRequest.addParam("key", "value");

addHeader

The addHeader method adds a header with a specified key and value to a request.

Specified by:

addHeader in interface BaseImplementation

Retour:
Type
AppRequest
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Chaîne

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
AppRequest appRequest = marketplace.request(); 
appRequest.addHeader("key", "value");

addHeaders

The addHeaders method adds headers to a HashMap and adds them to the request.

Specified by:

addHeaders provides support to add custom header to the request

Retour:
Type
AppRequest
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("marketplace.contentstack.io").build(); 
AppRequest appRequest = marketplace.request(); 
HashMap headers = new HashMap(); 
appRequest.addHeaders(headers);

addParams

The addParams method adds all the key-value pairs from the given HashMap to the queryParams HashMap and returns the updated AppRequest object.

Specified by:

addParams in interface BaseImplementation

Retour:
Type
AppRequest
NomTypeDescription

clé (obligatoire)

Chaîne

The key of the header to be added

valeur (obligatoire)

Objet

The value of the header to be added

Exemple :

Marketplace marketplace = new Marketplace.Builder("ORGANIZATION_UID") .host("api.contentstack.io").build(); 
AppRequest appRequest = marketplace.request(); 
HashMap headers = new HashMap(); 
appRequest.addParams(headers);