b2c-custom-api-development
БесплатноБез исполняемых скриптовНе проверенDevelop Custom SCAPI REST endpoints with api.json routes, schema.yaml definitions, and OAuth scope configuration. Use this skill whenever the user needs to…
от SalesforceCommerceCloud★ 58 звёзд на GitHubОб этом скилле
Custom API Development Skill
This skill guides you through developing Custom APIs for Salesforce B2C Commerce. Custom APIs let you expose custom script code as REST endpoints under the SCAPI framework.
Tip: If
b2cCLI is not installed globally, usenpx @salesforce/b2c-cliinstead (e.g.,npx @salesforce/b2c-cli code deploy).
Scope & grounding
This skill provides CLI-specific workflows and quickstart patterns for Custom API development. It covers OpenAPI 3.0 contract structure, OAuth scope configuration, cartridge-path resolution rules, and circuit breaker behavior. However, platform-specific validation rules, operational limits, security scheme requirements, and Script API integration patterns can drift across Commerce Cloud releases. Before answering questions that reference specific API versions or framework behavior, or before emitting code the user will run, confirm current platform specifics against the official documentation via b2c docs search / b2c docs read (CLI) or docs_search / docs_read (MCP). The official documentation is the authoritative source for Custom API contract specifications, runtime behavior, and B2C Commerce platform details not covered here.
Canonical docs (confirm platform specifics with these):
commerce-api/custom-apis- overview, cartridge resolution, operational limitscommerce-api/custom-api-components-references- schema.yaml and script.js requirementscommerce-api/custom-api-authentication- OAuth scope rules, security schemescommerce-api/custom-api-caching- caching behavior and configurationcommerce-api/custom-api-remote-includes- remote include patternscommerce-api/custom-api-circuit-breaker- current thresholds and behaviorcommerce-api/custom-api-troubleshooting- common issues and solutionscommerce-api/custom-api-status-report- registration status detailsdw.system.RESTResponseMgr- Script API response managerdw.system.Request- Script API request objectdw.system.RESTErrorResponse- Script API error responsedw.system.RESTSuccessResponse- Script API success response
Overview
A Custom API URL has this structure:
https://{shortCode}.api.commercecloud.salesforce.com/custom/{apiName}/{apiVersion}/organizations/{organizationId}/{endpointPath}
Three components are required to create a Custom API:
- API Contract - An OAS 3.0 schema file (YAML)
- API Implementation - A script using the B2C Commerce Script API
- API Mapping - An
api.jsonfile binding endpoints to implementations
Cartridge Structure
/my-cartridge
/cartridge
package.json
/rest-apis
/my-api-name # API name (lowercase alphanumeric and hyphens only)
api.json # Mapping file
schema.yaml # OAS 3.0 contract
script.js # Implementation
Important: API directory names can only contain alphanumeric lowercase characters and hyphens.
Component 1: API Contract (schema.yaml)
Illustrative minimal example; confirm current schema validation rules, security scheme structure, and scope naming requirements with
b2c docs read commerce-api/custom-api-components-referencesandb2c docs read commerce-api/custom-apis.
Minimal example:
openapi: 3.0.0
info:
version: 1.0.0
title: My Custom API
components:
securitySchemes:
ShopperToken:
type: oauth2
flows:
clientCredentials:
tokenUrl: https://{shortCode}.api.commercecloud.salesforce.com/shopper/auth/v1/organizations/{organizationId}/oauth2/token
scopes:
c_my_scope: My custom scope
parameters:
siteId:
name: siteId
in: query
required: true
schema:
type: string
minLength: 1
paths:
/my-endpoint:
get:
operationId: getMyData
parameters:
- $ref: '#/components/parameters/siteId'
responses:
'200':
description: Success
security:
- ShopperToken: ['c_my_scope']
Key requirements:
- Use
ShopperTokenfor Shopper APIs (requires siteId),AmOAuth2for Admin APIs - Custom scopes must start with
c_, max 25 chars - Custom parameters must have
c_prefix
Cartridge path requirements (where the platform looks up your rest-apis/ folder)
Illustrative of platform cartridge resolution rules; confirm current runtime behavior and site context handling with
b2c docs read commerce-api/custom-apis.
| Call shape | Cartridge path searched |
|---|---|
Shopper API (ShopperToken) — always site-scoped |
The storefront site's cartridge path (the site that issued the SLAS token) |
Admin API (AmOAuth2) with siteId=<storefront-site> |
That storefront site's cartridge path |
Admin API (AmOAuth2) with siteId=Sites-Site (the special BM/organization site) |
The Business Manager cartridge path |
Admin API (AmOAuth2) with siteId omitted |
Установить b2c-custom-api-development в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл b2c-custom-api-development?
Develop Custom SCAPI REST endpoints with api.json routes, schema.yaml definitions, and OAuth scope configuration. Use this skill whenever the user needs to create a custom API on the Commerce platform, define OpenAPI 3.0 schemas for request/response, structure the rest-apis cartridge folder, or debug endpoint registration and 404 issues. Also use when building headless commerce integrations, choosing between Shopper (`ShopperToken`) and Admin (`AmOAuth2`) APIs, or troubleshooting why a Custom API endpoint isn't appearing or returning 404 in `b2c scapi custom status` — even if they just say 'custom REST endpoint', 'expose my script as an API', or 'my admin custom API isn't registering'.
Как установить скилл b2c-custom-api-development?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл b2c-custom-api-development запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic