SkillAtlasSkill 详情

java

Contentstack is a headless CMS with an API-first approach.

审核状态:已审核Quality 72Security 90

复制安装命令

用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。

复制前请先查看来源、License 和安全提示。

项目 README

来源文件:README.md

抓取于 2026年7月29日

Contentstack

Contentstack Management Java SDK

Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. All you have to do is build your application frontend, and Contentstack will take care of the rest. Read More.

This SDK uses the Content Management API ( CMA). The CMA is used to manage the content of your Contentstack account. This includes creating, updating, deleting, and fetching content of your account. To use the CMA, you will need to authenticate your users with a Management Token or an Authtoken. Read more about it in Authentication.

Note: By using CMA, you can execute GET requests for fetching content. However, we strongly recommend that you always use the Content Delivery API to deliver content to your web or mobile properties.

Prerequisite

You need Java 8 or above installed on your machine to use the Contentstack Management Java SDK.

Installation

Install it via maven:

<dependency>
   <groupId>com.contentstack.sdk</groupId>
   <artifactId>cms</artifactId>
   <version>{version}</version>
</dependency>

Install it via gradle:

implementation'com.contentstack.sdk:cms:{version}'

To import the SDK, use the following command:

package com.contentstack.cms;
Contentstack contentstack = new Contentstack.Builder().build();

Authentication

To use this SDK, you need to authenticate your users by using the Authtoken, credentials, or Management Token ( stack-level token).

Authtoken

An Authtoken is a read-write token used to make authorized CMA requests, and it is a user-specific token.

Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();

Login

To Login to Contentstack by using credentials, you can use the following lines of code:

Contentstack contentstack = new Contentstack.Builder().build();
contentstack.login("EMAIL","PASSWORD");

Management Token

Management Tokens are * stack-level* tokens, with no users attached to them.

Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
Stack stack=contentstack.stack("API_KEY","MANAGEMENT_TOKEN");

Contentstack Management Java SDK: 5-minute Quickstart

Initializing Your SDK

To use the Java CMA SDK, you need to first initialize it. To do this, use the following code:

Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();

Fetch Stack Detail

Use the following lines of code to fetch your stack detail using this SDK:

Stack stack = contentstack.stack("API_KEY");
Response<ResponseBody> response = stack.fetch().execute();

Create Entry

To create an entry in a specific content type of a stack, use the following lines of code:

Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
Stack stack=contentstack.stack("API_KEY");
JSONObject body = ....
Response<ResponseBody> response=entry.create(body).execute();
if(response.isSuccessful()){
   System.out.println(response.body());
}

Create Asset

The following lines of code can be used to upload assets to your stack:

Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
Stack stack=contentstack.stack("API_KEY");
Asset asset=stack.asset();
Response<ResponseBody> response=asset.uploadAsset("filePath","description").execute();
if(response.isSuccessful()){
   System.out.println(response.body());
}else{
   System.out.println(response.errorBody());
}

Helpful Links

The MIT License (MIT)

Copyright © 2012-2025 Contentstack. All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

开发与工程

低风险

  • 来源需自行核对维护者身份。
  • 未检测到明显脚本安装指令。
  • 可能需要外部 token、网络权限或第三方服务。
  • 未检测到高风险命令。
  • 扫描发现:0 条。

Codex — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/contentstack/contentstack-management-java.git
  3. 将 "skills/java" 文件夹复制到 Codex 的 skills 目录中。
  4. 重启 Codex 让新的 skill 生效。

Codex — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Codex 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Codex 让新的 skill 生效。

Claude Code — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/contentstack/contentstack-management-java.git
  3. 将 "skills/java" 文件夹复制到 Claude Code 的 skills 目录中。
  4. 重启 Claude Code 让新的 skill 生效。

Claude Code — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Claude Code 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Claude Code 让新的 skill 生效。

Cursor — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/contentstack/contentstack-management-java.git
  3. 将 "skills/java" 文件夹复制到 Cursor 的 skills 目录中。
  4. 重启 Cursor 让新的 skill 生效。

Cursor — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Cursor 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Cursor 让新的 skill 生效。

GitHub Copilot — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/contentstack/contentstack-management-java.git
  3. 将 "skills/java" 文件夹复制到 GitHub Copilot 的 skills 目录中。
  4. 重启 GitHub Copilot 让新的 skill 生效。

GitHub Copilot — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 GitHub Copilot 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 GitHub Copilot 让新的 skill 生效。

Windsurf — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/contentstack/contentstack-management-java.git
  3. 将 "skills/java" 文件夹复制到 Windsurf 的 skills 目录中。
  4. 重启 Windsurf 让新的 skill 生效。

Windsurf — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Windsurf 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Windsurf 让新的 skill 生效。
查看 SKILL.md 原文
name: java
description: Use for Java package layout, Java 8 constraints, Lombok, and coding conventions in this repository.

Java – Contentstack Management Java SDK

When to use

  • You add new types under com.contentstack.cms or reorganize packages.
  • You need to stay compatible with Java 8 (maven.compiler.source / target = 1.8).
  • You use or configure Lombok and need to match existing patterns.

Instructions

Layout

  • Main code: src/main/java/com/contentstack/cms/ — core client in Contentstack, stack features under stack/, HTTP helpers in core/, OAuth under oauth/, models under models/.
  • Tests: mirror packages under src/test/java/com/contentstack/cms/; Surefire includes **/Test*.java, **/*Test.java, **/*Tests.java, and related patterns per pom.xml.

Language level

  • Do not use language or library features that require a JVM newer than 8 for source compatibility unless the project explicitly upgrades (check maven-compiler-plugin and <maven.compiler.source> in pom.xml).

Lombok and tooling

  • Lombok is on the annotation processor path; prefer the same style as neighboring classes (@Getter, @Builder, etc.) instead of mixing hand-written boilerplate inconsistently.
  • JetBrains @NotNull / nullable annotations appear in places like Contentstack; follow existing nullability hints for new APIs.

Compiler

  • The compiler enables broad -Xlint checks; fix new warnings rather than suppressing without cause.

References

发现问题?提交给管理员复核

评分:

评论 (0)

暂无评论,成为第一个评论者吧!