
Sap Api Style
- 428 installs
- 399 repo stars
- Updated August 4, 2026
- secondsky/sap-skills
Design OData and REST APIs that follow SAP naming, versioning, error handling, and documentation conventions for BTP, S/4HANA, and partner-facing integrations.
About
Enforces SAP API style for OData and REST services on BTP and S/4HANA: consistent naming, versioning, pagination, errors, and documentation patterns. Helps teams building API and SaaS integrations avoid rework, partner rejection, and inconsistent contracts across multi-system SAP landscapes.
- SAP API naming conventions
- OData and REST patterns
- Versioning and deprecation rules
- Standard error payloads
- Integration-ready service design
Sap Api Style by the numbers
- 428 all-time installs (skills.sh)
- +37 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #1,028 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/secondsky/sap-skills --skill sap-api-styleAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 428 |
|---|---|
| repo stars | ★ 399 |
| Last updated | August 4, 2026 |
| Repository | secondsky/sap-skills ↗ |
What it does
Design OData and REST APIs that follow SAP naming, versioning, error handling, and documentation conventions for BTP, S/4HANA, and partner-facing integrations.
Files
SAP API Style Guide
Related Skills
- sap-cap-capire: Use for OData service documentation, CAP API patterns, and service definition standards
- sap-fiori-tools: Use for API consumption patterns, Fiori app integration, and OData best practices
- sap-abap: Use when documenting ABAP APIs, implementing REST services, or following API design patterns
- sapui5: Use for frontend API integration, OData consumption, and UI service patterns
- sap-btp-cloud-platform: Use for BTP service API documentation and integration patterns
Table of Contents
1. Overview 2. When to Use This Skill 3. Quick Decision Tree 4. Core Principles 5. Quick Reference Tables 6. Templates Available 7. Reference Files 8. Instructions for Use 9. Common Pitfalls to Avoid 10. External Resources 11. Updates and Maintenance 12. Common Issues
Overview
This skill provides comprehensive guidance for documenting SAP APIs according to official SAP API Style Guide standards. It covers all major API types and documentation approaches used across the SAP ecosystem.
Documentation Source: https://github.com/SAP-docs/api-style-guide (76 files extracted)
When to Use This Skill
Use this skill when:
- Creating API documentation for REST, OData, Java, JavaScript, .NET, or C/C++ APIs
- Writing OpenAPI specifications for SAP API Business Hub
- Reviewing API names for SAP naming convention compliance
- Documenting API parameters, responses, operations with proper formatting
- Creating manual API documentation using SAP templates
- Writing documentation comments in source code (Javadoc, JSDoc, XML comments)
- Implementing API deprecation following SAP lifecycle policies
- Developing developer guides or service documentation
- Performing quality checks on API documentation
- Publishing APIs to SAP API Business Hub
Quick Decision Tree
What Type of API?
REST/OData API
├─ Auto-generated (OpenAPI/Swagger)?
│ └─ references/rest-odata-openapi-guide.md
│ • OpenAPI specification standards
│ • Package, API, operation descriptions
│ • Parameters, responses, components
│ • SAP API Business Hub requirements
│
└─ Manually written?
└─ references/manual-templates-guide.md
• REST templates (2-level: overview → method)
• OData templates (3-level: service → resource → operation)
• Complete field requirements
• templates/ directory for ready-to-use files
Native Library API
├─ Java → references/java-javascript-dotnet-guide.md
├─ JavaScript → references/java-javascript-dotnet-guide.md
├─ .NET (C#) → references/java-javascript-dotnet-guide.md
└─ C/C++ → references/java-javascript-dotnet-guide.md
• Documentation comments structure
• Language-specific tags
• Templates for classes, methods, enums
• Complete code examplesWhat Task?
Naming
└─ references/naming-conventions.md
• REST/OData naming (resources, parameters, URIs)
• Native library naming (classes, methods, constants)
• Common mistakes to avoid
Writing Descriptions
└─ references/rest-odata-openapi-guide.md
• Package descriptions
• API details (info object)
• Operations, parameters, responses
Quality Assurance
└─ references/quality-processes.md
• Complete API Quality Checklist
• Review workflows
• Development team guidelines
Deprecating APIs
└─ references/deprecation-policy.md
• Lifecycle states (beta, active, deprecated, decommissioned)
• Timeline requirements (12+ months support)
• Required metadata (x-sap-stateInfo)
Developer Guides
└─ references/developer-guides.md
• Structure guidelines
• Content selection
• Code sample standardsCore Principles
1. Consistency Across SAP APIs
All SAP API documentation follows consistent conventions:
- Naming: Language-specific (camelCase, PascalCase, kebab-case)
- Structure: Hierarchical with clear navigation
- Formatting: Sentences start with capitals, end with periods
- Language: American English
2. API-Type-Specific Standards
| API Type | Standard | Tool | Documentation |
|---|---|---|---|
| REST | OpenAPI 3.0.3 | Swagger | Spec |
| OData | v4.01, v3.0, v2.0 | Various | OData.org |
| Java | Javadoc | javadoc | Oracle |
| JavaScript | JSDoc 3 | jsdoc | JSDoc.app |
| .NET | XML Comments | DocFX | Microsoft |
| C/C++ | Doxygen | doxygen | Doxygen.nl |
3. Progressive Disclosure
Documentation organized hierarchically:
- High-level overviews provide context and navigation
- Detailed references cover specific APIs, methods, operations
- Examples and templates demonstrate practical usage
4. Quality Standards
All documentation must:
- ✅ Be reviewed by User Assistance (UA) developers
- ✅ Use consistent naming and terminology
- ✅ Include complete parameter and response descriptions
- ✅ Avoid sensitive data in examples
- ✅ Provide working code examples
- ✅ Maintain accurate links and cross-references
Quick Reference Tables
Character Limits
| Element | Limit | Use Case |
|---|---|---|
| API Title | 80 | info.title in OpenAPI |
| API Short Text | 180 | x-sap-shortText |
| Package Short Desc | 250 | Package tile description |
| Operation Summary | 255 | Operation summary line |
| Description | 1024 | General descriptions |
API Naming Rules
General Rules (all API types):
- ❌ Don't include "API" in name: ~~"Custom Forms API"~~ → ✅ "Custom Forms"
- ❌ Don't include "SAP" prefix: ~~"SAP Document Approval"~~ → ✅ "Document Approval"
- ❌ Don't use verbs: ~~"Configuring Portal"~~ → ✅ "Portal Configuration"
- ✅ Capitalize words properly
- ✅ Avoid technical specifics (REST, OData, etc.)
See references/naming-conventions.md for complete language-specific rules.
Common Documentation Tags
Java/JavaScript:
@param <name> <description>- Parameter documentation@return <description>- Return value@throws <class> <description>- Exception@deprecated <description>- Deprecation notice
.NET:
<summary>- Brief description<param name="">- Parameter<returns>- Return value<exception cref="">- Exception
See references/java-javascript-dotnet-guide.md for complete tag reference.
API Lifecycle States
| State | Definition | Support | Metadata Required |
|---|---|---|---|
| Beta | Pre-production testing | No guarantees | state: beta |
| Active | Production-ready (default) | Full support | Optional |
| Deprecated | Replaced by successor | 12+ months | state, deprecationDate, successorApi |
| Decommissioned | Fully retired | None | Document removal |
See references/deprecation-policy.md for complete timeline and process requirements.
Large Reference Search Routing
Search large references before loading them. Use rg -n "<resource|operation|parameter|description|template|deprecation|x-sap-stateInfo>" references/*.md to locate the exact rule, then open only the relevant excerpt.
- Use
references/manual-templates-guide.mdfor manually written REST/OData documentation templates. Search forREST API Template,OData Operation Template,field requirements,method, or the resource name. - Use
references/rest-odata-openapi-guide.mdfor OpenAPI, OData, operation descriptions, responses, parameters, and SAP API Business Hub publication checks. - Use
references/naming-conventions.mdfor resource, operation, package, class, method, parameter, enum, and constant naming. - Use
references/java-javascript-dotnet-guide.mdfor Javadoc, JSDoc, XML doc comments, and native SDK documentation tags. - Use
references/deprecation-policy.mdfor lifecycle state, migration guidance, andx-sap-stateInfo. - Use
references/quality-processes.mdfor review checklists, gates, and documentation quality workflows.
Templates Available
Ready-to-use templates in templates/ directory:
REST API Templates (2-Level)
1. rest-api-overview-template.md - Resource-level overview 2. rest-api-method-template.md - Individual endpoint details
OData API Templates (3-Level)
1. odata-service-overview-template.md - Complete service overview 2. odata-resource-template.md - Individual resource/entity set 3. odata-operation-template.md - Specific operation details
All templates include:
- Clear "How to Use" instructions
- [Placeholder text] for customization
- Complete section structure
- Working examples
- Inline guidance
Reference Files
Complete Guides Available
1. rest-odata-openapi-guide.md (2,800 lines)
- Complete OpenAPI specification guidelines
- Package, API, operation descriptions
- Parameters, responses, components
- Security schemes, tags, external docs
- Character limits and anti-patterns
2. manual-templates-guide.md (2,765 lines)
- REST API templates (2-level hierarchy)
- OData API templates (3-level hierarchy)
- Complete template structures
- Field-by-field requirements
- Best practices and examples
3. naming-conventions.md (2,059 lines)
- REST/OData naming rules (resources, parameters, URIs)
- Native library naming (classes, methods, constants, packages)
- Language-specific conventions
- Common mistakes with fixes
- Decision trees and reference tables
4. quality-processes.md (1,774 lines)
- Complete API Quality Checklist
- Review workflows (developer + UA collaboration)
- Development team guidelines
- Common review findings and solutions
- Process flowcharts
5. java-javascript-dotnet-guide.md (1,517 lines)
- Documentation comments structure
- Language-specific tags (Java, JavaScript, .NET, C/C++)
- Templates for classes, methods, enums
- Complete code examples
- Best practices by language
6. developer-guides.md (704 lines)
- Guide structure standards
- Topic types (concept, reference, task)
- Content selection criteria
- Code sample standards (compilable, concise, commented)
- Best practices
7. deprecation-policy.md (664 lines)
- API lifecycle states (beta, active, deprecated, decommissioned)
- Timeline requirements (12+ months support, 24+ months lifespan)
- Required metadata (x-sap-stateInfo, artifact.json)
- Decommission process
- Complete examples
8. glossary-resources.md (472 lines)
- Complete terminology definitions (API, OData, OpenAPI, etc.)
- External resource links (standards, tools, SAP resources)
- Quick reference tables
- Tool documentation links
- Content extraction and organization tracking
- Source file mapping from SAP documentation
- Consolidation and adaptation notes
Bundled Resources
This skill includes comprehensive documentation and templates organized for optimal use:
Reference Guides (references/)
- 9 detailed reference files (10,861 total lines)
- Complete coverage of SAP API Style Guide standards
- Progressive disclosure architecture for efficient loading
Template Files (templates/)
1. rest-api-overview-template.md (217 lines) - Level 1 REST overview 2. rest-api-method-template.md (477 lines) - Level 2 REST method details 3. odata-service-overview-template.md (411 lines) - Level 1 OData service 4. odata-resource-template.md (557 lines) - Level 2 OData resource 5. odata-operation-template.md (681 lines) - Level 3 OData operation
Total: 2,343 lines of ready-to-use templates
Instructions for Use
Step 1: Identify API Type
Determine if you're documenting REST, OData, Java, JavaScript, .NET, or C/C++ API.
Step 2: Choose Approach
Auto-Generated: Write documentation comments in source code → Use appropriate tags → Submit for review
Manual: Select template from templates/ → Customize [placeholders] → Follow hierarchy → Validate with checklist
Step 3: Apply Standards
Consult appropriate reference file:
- Naming:
naming-conventions.md - Descriptions:
rest-odata-openapi-guide.mdorjava-javascript-dotnet-guide.md - Quality:
quality-processes.md - Deprecation:
deprecation-policy.md
Step 4: Quality Check
Before publishing: 1. Review against API Quality Checklist (quality-processes.md) 2. Verify naming conventions (naming-conventions.md) 3. Check character limits (see Quick Reference Tables above) 4. Validate no sensitive data in examples 5. Test all code examples 6. Verify links work 7. Obtain UA developer review
Step 5: Publish
- REST/OData: Submit to SAP API Business Hub
- Java/JavaScript/.NET: Generate with appropriate tool (Javadoc, JSDoc, DocFX)
- Developer Guides: Publish to SAP Help Portal or product documentation
Common Pitfalls to Avoid
Naming:
- ❌ Including "API": ~~"Custom Forms APIs"~~ → ✅ "Custom Forms"
- ❌ Using "SAP" prefix: ~~"SAP Document Approval"~~ → ✅ "Document Approval"
- ❌ Using verbs: ~~"Configuring Portal"~~ → ✅ "Portal Configuration"
Descriptions:
- ❌ Second person: ~~"This operation creates..."~~ → ✅ "Creates a new user"
- ❌ Generic responses: ~~"No content"~~ → ✅ "Product is out of stock"
- ❌ Repeating summary in description
Documentation:
- ❌ Skipping UA review
- ❌ Including sensitive data in examples
- ❌ Missing required tags
- ❌ Inconsistent terminology
See individual reference files for complete anti-patterns and fixes.
Common Issues
| Issue | Correction |
|---|---|
| API names use verbs or redundant "API" suffixes | Apply the naming rules in references/naming-conventions.md before writing descriptions. |
| OpenAPI descriptions are too generic | Use operation-specific outcomes, error cases, and state information from references/rest-odata-openapi-guide.md. |
| Documentation contains sensitive sample data | Replace tenant, user, token, and customer data with neutral examples before publishing. |
| Deprecation metadata is missing | Add x-sap-stateInfo and migration guidance from references/deprecation-policy.md. |
External Resources
Standards
- OpenAPI Specification: https://spec.openapis.org/oas/latest.html
- OData v4.01: https://www.odata.org/documentation/
- Javadoc: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
- JSDoc 3: https://jsdoc.app/
- Doxygen: https://www.doxygen.nl/
SAP Resources
- SAP API Business Hub: https://api.sap.com/
- SAP Developer Center: https://developers.sap.com/
- SAP Help Portal: https://help.sap.com/
- SAP Community: https://community.sap.com/
Source
- SAP API Style Guide: https://github.com/SAP-docs/api-style-guide
Updates and Maintenance
Source Version: SAP API Style Guide 2025.01 (verified against commit 902247f)
Recent Changes:
- Source repository updated 2025-10-28
- Reference file line counts verified and updated
- Added comprehensive Table of Contents for navigation
- Added Bundled Resources section for content discovery
To Update This Skill: 1. Check source repository for changes: https://github.com/SAP-docs/api-style-guide 2. Review "What's New in the Style Guide" 3. Update affected reference files 4. Update templates if standards changed 5. Update "Last Verified" date
Quarterly Review Recommended: Check for updates every 3 months
Next Review: 2026-02-27
---
Skill Version: 2.3.2 Last Updated: 2026-06-14 License: GPL-3.0 Maintainer: Eduard Jiglau | hello@sap-ai-skills.com | sap-ai-skills.com | https://github.com/secondsky/sap-skills
SAP API Style Guide – Skill
Version: 1.1.0 Last Updated: 2025-11-27
---
Capability Index
| Capability | Status |
|---|---|
| Commands | 1: /api-style-review |
| Agents | 1: api-style-reviewer |
| Hooks | No |
| MCP | No |
| LSP | No |
| Source Freshness | last_verified: 2026-02-25; large reference routing added, upstream re-verification pending. |
| Verification | npm run validate; API owner/runtime catalog checks pending unless documented. |
Attribution & License
Upstream Content
This skill incorporates content from the SAP API Style Guide:
- Upstream Repository: SAP-docs/api-style-guide
- Source Commit: main branch as of 2025-11-21
- Upstream License: CC BY 4.0 (Creative Commons Attribution 4.0 International)
- License Summary: Permits sharing and adaptation with attribution; requires attribution to SAP and indication of changes
Content Usage
Verbatim Content (directly copied from upstream):
- Core documentation examples and patterns from SAP API Style Guide
- Code sample structures and formatting guidelines
- Terminology definitions and standards references
Adapted Content (modified from upstream):
- All reference files in
references/- consolidated from multiple upstream files, reorganized for progressive disclosure - All template files in
templates/- enhanced with additional examples and Claude Code-specific guidance - SKILL.md - restructured from upstream documentation into decision trees and quick references
Original Content (created for this skill):
- Progressive disclosure architecture and file organization
- Claude Code skill-specific metadata and trigger keywords
- Cross-references and navigation structure optimized for LLM consumption
SPDX License Identifiers
- Upstream SAP content:
CC-BY-4.0 - Skill packaging and structure:
MIT
Full License Text
- CC BY 4.0: https://creativecommons.org/licenses/by/4.0/legalcode
- MIT: See LICENSE file in repository root
---
Overview
Documents SAP APIs following official SAP API Style Guide standards for REST, OData, Java, JavaScript, .NET, and C/C++ APIs.
Auto-Trigger Keywords
This skill automatically activates when you mention:
API Types
- REST API documentation
- OData API documentation
- OData service documentation
- Java API documentation
- JavaScript API documentation
- .NET API documentation
- C# API documentation
- C++ API documentation
- OpenAPI specification
- Swagger documentation
- Javadoc
- JSDoc
- XML documentation comments
- Doxygen documentation
SAP-Specific
- SAP API Business Hub
- SAP API naming
- SAP API standards
- SAP API deprecation
- SAP API quality
- SAP API review
- SAP developer guide
- SAP service guide
- SAP REST API
- SAP OData service
- SAP Cloud Platform API
- SAP BTP API
- SAP Integration Suite
Documentation Tasks
- API naming conventions
- API documentation comments
- API reference documentation
- API parameter documentation
- API response documentation
- OpenAPI info object
- OpenAPI components
- OpenAPI paths
- OpenAPI security
- OData entity model
- OData EDM
- OData metadata
- Entity Data Model
Quality & Processes
- API quality checklist
- API review process
- API documentation standards
- API deprecation policy
- API lifecycle management
- x-sap-stateInfo
- API versioning
- API decommission
Documentation Elements
- @param tag
- @return tag
- @throws tag
- @deprecated tag
- summary tag
- description tag
- package description
- method documentation
- class documentation
- interface documentation
- operation documentation
- endpoint documentation
- parameter description
- response description
- error code documentation
- status code documentation
Templates
- REST API template
- OData API template
- API overview template
- API method template
- OData service template
- OData resource template
- OData operation template
- manual API documentation
- API documentation template
---
When to Use
Use this skill when:
- Creating REST or OData API documentation for SAP systems
- Writing OpenAPI specifications for SAP API Business Hub
- Documenting Java, JavaScript, .NET, or C/C++ APIs with proper tags
- Reviewing API names for SAP naming convention compliance
- Writing documentation comments in source code (Javadoc, JSDoc, XML)
- Creating manual API documentation using SAP templates
- Implementing API deprecation following SAP policies
- Performing quality checks on API documentation
- Publishing APIs to SAP API Business Hub
- Developing developer guides for SAP services
---
Key Features
Comprehensive Coverage
- ✅ REST API Documentation (OpenAPI 3.0.3)
- ✅ OData API Documentation (v4.01, v3.0, v2.0)
- ✅ Java API Documentation (Javadoc)
- ✅ JavaScript API Documentation (JSDoc)
- ✅ .NET API Documentation (XML comments)
- ✅ C/C++ API Documentation (Doxygen)
Reference Files (8 Comprehensive Guides)
1. REST/OData OpenAPI Guide (73KB, 2,794 lines)
- Complete OpenAPI specification guidelines
- Package, API, operation descriptions
- Parameters, responses, components
- SAP API Business Hub requirements
2. Manual Templates Guide (79KB, 2,761 lines)
- REST API templates (2-level hierarchy)
- OData API templates (3-level hierarchy)
- Complete template structures
- Field-by-field requirements
3. Naming Conventions (53KB, 2,042 lines)
- REST/OData naming rules
- Native library naming standards
- Language-specific conventions
- Common mistakes to avoid
4. Quality & Review Processes (53KB, 1,769 lines)
- API Quality Checklist
- Review workflows
- Development team guidelines
- Common review findings
5. Java/JavaScript/.NET Guide (Comprehensive)
- Documentation comments structure
- Language-specific tags
- Templates for classes, methods, enums
- Complete code examples
6. Deprecation Policy (Complete)
- API lifecycle states
- Timeline requirements
- Metadata specifications
- Decommission process
7. Developer Guides (Complete)
- Guide structure standards
- Content selection criteria
- Code sample requirements
- Topic type conventions
8. Glossary & Resources (Complete)
- Complete terminology
- External resource links
- Tool references
- Quick reference tables
Template Files (5 Ready-to-Use Templates)
1. REST API Overview Template (Level 1) 2. REST API Method Template (Level 2) 3. OData Service Overview Template (Level 1) 4. OData Resource Template (Level 2) 5. OData Operation Template (Level 3)
Progressive Disclosure
- SKILL.md: Quick decision trees and overview
- References: Detailed guidelines loaded when needed
- Templates: Ready-to-customize documentation templates
---
Quick Start
For REST APIs
1. Choose template: REST API Overview (Level 1)
2. Customize: Replace [placeholders] with your API info
3. Create methods: Use REST API Method template (Level 2)
4. Review: Check against API Quality Checklist
5. Publish: Submit to SAP API Business HubFor OData Services
1. Choose template: OData Service Overview (Level 1)
2. Document resources: Use OData Resource template (Level 2)
3. Document operations: Use OData Operation template (Level 3)
4. Review: Verify Entity Data Model (EDM)
5. Publish: Submit with $metadata endpointFor Java/JavaScript/.NET APIs
1. Write documentation comments in source code
2. Use appropriate tags (@param, @return, @throws, etc.)
3. Follow naming conventions for language
4. Submit for UA review early
5. Generate and verify output---
Skill Structure
sap-api-style/
├── SKILL.md # Main skill file
├── README.md # This file
│
├── references/ # Detailed reference guides
│ ├── rest-odata-openapi-guide.md # REST/OData OpenAPI docs
│ ├── manual-templates-guide.md # Manual template reference
│ ├── java-javascript-dotnet-guide.md # Native library docs
│ ├── naming-conventions.md # Naming standards
│ ├── quality-processes.md # Quality & review processes
│ ├── deprecation-policy.md # API lifecycle management
│ ├── developer-guides.md # Developer guide standards
│ ├── glossary-resources.md # Glossary & external resources
│
└── templates/ # Ready-to-use templates
├── rest-api-overview-template.md
├── rest-api-method-template.md
├── odata-service-overview-template.md
├── odata-resource-template.md
└── odata-operation-template.md---
Examples
Example 1: REST API Naming
❌ Incorrect:
- "SAP Document Approval REST API"
- "Get Customer Data"
- "employee-service"
✅ Correct:
- "Document Approval"
- "getCustomerData"
- "employeeService"
Example 2: Operation Description
❌ Incorrect:
description: "This operation creates a new customer in the system"✅ Correct:
summary: "Create customer"
description: "Creates a new customer with provided details. Returns customer ID on success."Example 3: Deprecation
x-sap-stateInfo:
state: deprecated
deprecationDate: "2024-01-15"
successorApi: "Customer Management API v2.0"---
Character Limits Quick Reference
| Element | Limit | Use Case |
|---|---|---|
| API Title | 80 | info.title |
| API Short Text | 180 | x-sap-shortText |
| Package Short Desc | 250 | Package tile description |
| Operation Summary | 255 | Operation summary line |
| Description | 1024 | General descriptions |
---
External Resources
Standards
- OpenAPI Specification: https://spec.openapis.org/oas/latest.html
- OData v4.01: https://www.odata.org/documentation/
- Javadoc Tool: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
- JSDoc 3: https://jsdoc.app/
- Doxygen: https://www.doxygen.nl/
SAP Resources
- SAP API Business Hub: https://api.sap.com/
- SAP Developer Center: https://developers.sap.com/
- SAP Help Portal: https://help.sap.com/
- SAP Community: https://community.sap.com/
Source
- SAP API Style Guide: https://github.com/SAP-docs/api-style-guide
---
Token Efficiency
This skill saves massive token overhead by:
- Preventing trial-and-error in API documentation formatting
- Providing templates instead of generating from scratch
- Progressive disclosure loading only relevant content
- Reference lookup instead of explaining standards repeatedly
Estimated Savings: 60-70% reduction in tokens vs. manual documentation creation
---
Compliance
✅ Follows SAP official standards (verified 2025-11-21) ✅ Aligned with OpenAPI Specification 3.0.3 ✅ Supports OData v4.01, v3.0, v2.0 ✅ Compatible with SAP API Business Hub requirements ✅ Includes SAP-specific extensions (x-sap-stateInfo)
---
Updates
Version 1.1.0 (2025-11-27)
Enhancements:
- Added comprehensive Table of Contents to SKILL.md for improved navigation
- Added Bundled Resources section listing all reference files and templates with accurate line counts
- Verified and updated all reference file line counts (total: 10,861 lines)
- Verified source repository commit (902247f3) and updated source version to 2025.01
- Enhanced metadata with source license information (CC-BY-4.0)
- Improved content discoverability and progressive disclosure architecture
Version 1.0.0 (2025-11-21)
Initial Release:
- Complete extraction from SAP API Style Guide (16 source files verified)
- 9 comprehensive reference guides (consolidated and adapted)
- 5 ready-to-use templates (enhanced with examples)
- Full coverage of REST, OData, Java, JavaScript, .NET, C/C++
- Progressive disclosure structure optimized for Claude Code
- Production-tested templates and examples
Next Quarterly Review: 2026-02-27
---
Contributing
This skill is maintained as part of the SAP Skills repository:
- Repository: https://github.com/secondsky/sap-skills
- Issues: https://github.com/secondsky/sap-skills/issues
- License: MIT
---
License
GPL-3.0 License - See LICENSE file for details
---
Maintainer: Eduard Jiglau | hello@sap-ai-skills.com | sap-ai-skills.com | https://github.com/secondsky/sap-skills Skill Version: 1.1.0 Last Verified Against SAP Standards: 2026-02-25
SAP API Deprecation Policy
Source: https://github.com/SAP-docs/api-style-guide/blob/main/docs/api-deprecation-policy-65a10e3.md Last Verified: 2025-11-21
Attribution: Content derived from SAP API Style Guide (Licensed under CC BY 4.0)
Changes: Consolidated from multiple source files, reorganized for progressive disclosure, added examples and templates.
---
Table of Contents
1. Overview 2. API Lifecycle States 3. Timeline Requirements 4. Required Metadata 5. Stakeholder Responsibilities 6. Deprecation Process 7. Decommission Process 8. Best Practices 9. Examples
---
Overview
Core Definition
A deprecated API "is no longer supported in future releases, and therefore not encouraged for use."
A decommissioned API has been fully retired and cannot be used in production.
Key Principles
1. Transparency: Clearly communicate API lifecycle state to consumers 2. Predictability: Provide adequate notice before decommissioning 3. Support: Maintain deprecated APIs for minimum periods 4. Documentation: Update all documentation to reflect current state 5. Migration Guidance: Provide clear paths to successor APIs
---
API Lifecycle States
SAP APIs use the x-sap-stateInfo attribute to define four lifecycle states:
1. Beta
Definition: Pre-production testing phase
Characteristics:
- Available for testing and evaluation
- May have incompatible changes without notice
- Not recommended for production use
- No support guarantees
Use Case: Early adopters testing new functionality
Metadata:
x-sap-stateInfo:
state: beta2. Active
Definition: Live production-ready APIs
Characteristics:
- Fully supported for production use
- Backward compatibility maintained
- Default status (can be omitted from metadata)
- Full support and SLAs apply
Use Case: Standard production API usage
Metadata:
x-sap-stateInfo:
state: activeOr simply omit the attribute (active is default).
3. Deprecated
Definition: Live but replaced by an active successor
Characteristics:
- Still functional and supported (temporarily)
- Not recommended for new implementations
- Requires migration to successor API
- Support period defined (minimum 12 months)
- Must include deprecation date and successor information
Use Case: Legacy APIs being phased out
Metadata:
x-sap-stateInfo:
state: deprecated
deprecationDate: "2024-01-15"
successorApi: "NewAPIName v2.0"4. Decommissioned
Definition: Retired from production
Characteristics:
- No longer functional
- Cannot be used in any environment
- Removed from documentation
- No support available
Use Case: Fully retired APIs
Implementation: Remove from artifact or mark in changelog
---
Timeline Requirements
Minimum Support Period After Deprecation
12 months minimum support period after deprecation announcement
Calculation:
- Starts from deprecation announcement date
- Continues until decommission date
- Allows customers adequate migration time
Example Timeline:
Jan 15, 2024: API deprecated (announcement)
Jan 15, 2025: Earliest decommission date (12 months later)Minimum Total Lifespan
24 months minimum total lifespan in active or deprecated status before decommissioning
Calculation:
- Starts from initial active release
- Includes time in active state + time in deprecated state
- Ensures reasonable API stability
Example Timeline:
Jan 1, 2022: API released (active)
Jan 1, 2024: API deprecated (24 months active)
Jan 1, 2025: Earliest decommission (12 months deprecated)
Alternative:
Jan 1, 2022: API released (active)
Jun 1, 2022: API deprecated (6 months active)
Jun 1, 2024: Earliest decommission (18 months deprecated, 24 total)Best Practice Timeline
SAP recommends:
- Active period: 18-36 months before deprecation
- Deprecation period: 12-24 months before decommission
- Total lifespan: 30+ months for production APIs
---
Required Metadata
OpenAPI Specification
APIs must include x-sap-stateInfo object in the OpenAPI specification file:
openapi: 3.0.0
info:
title: Employee Management API
version: 1.5.0
x-sap-stateInfo:
state: deprecated
deprecationDate: "2024-01-15"
successorApi: "Employee Management API v2.0"Required Fields for Deprecated APIs:
state: Must be "deprecated"deprecationDate: ISO 8601 date format (YYYY-MM-DD)successorApi: Name and version of replacement API
Artifact.json
APIs must include changelog entries in artifact.json:
{
"changelog": [
{
"state": "deprecated",
"date": "2024-01-15",
"version": "1.5.0",
"notes": "Deprecated in favor of Employee Management API v2.0. Migration guide available at https://help.sap.com/migration-guide"
},
{
"state": "active",
"date": "2022-01-01",
"version": "1.0.0",
"notes": "Initial release"
}
]
}Required Fields:
state: Current API statedate: State change date (ISO 8601 format)version: API version at state changenotes: Descriptive information about the change
---
Stakeholder Responsibilities
Product Owners
Lifecycle Decisions:
- Determine when to deprecate APIs
- Decide deprecation timelines
- Identify successor APIs
- Approve decommission schedules
Metadata Configuration:
- Ensure
x-sap-stateInfoproperly configured - Maintain accurate
artifact.jsonchangelog - Verify metadata consistency across systems
Communication:
- Announce deprecation through release notes
- Publish blog posts about major deprecations
- Notify affected customers directly
- Provide migration timelines
Support Management:
- Maintain support during deprecation period
- Allocate resources for customer migration assistance
- Track migration progress
- Coordinate decommission activities
UA (User Assistance) Developers
Documentation Updates:
- Add deprecation notices to API documentation
- Update API reference pages with warnings
- Create prominent deprecation banners
- Link to successor API documentation
Decommission Documentation:
- Remove links to decommissioned APIs
- Archive old documentation appropriately
- Redirect old URLs to successor documentation
- Update navigation and search indices
Source Code Tags:
- Apply
@deprecatedtag in Javadoc/JSDoc comments - Include deprecation reason and alternative
- Update inline documentation
- Add migration code examples
Migration Guidance:
- Create migration guides in release notes
- Document API differences
- Provide code migration examples
- Publish before-and-after comparisons
Development Teams
Code Maintenance:
- Continue bug fixes during deprecation period
- Maintain security patches
- No new feature development
- Plan removal timeline
Testing:
- Maintain test coverage during deprecation
- Test successor API thoroughly
- Validate migration paths
- Monitor customer usage patterns
---
Deprecation Process
Step 1: Decision and Planning
1. Assess API Usage:
- Review usage metrics and analytics
- Identify affected customers
- Estimate migration effort
2. Define Successor:
- Identify replacement API
- Document migration path
- Create migration guide
3. Set Timeline:
- Calculate minimum support period (12 months)
- Verify total lifespan requirement (24 months)
- Set deprecation and decommission dates
Step 2: Update Metadata
1. OpenAPI Specification:
x-sap-stateInfo:
state: deprecated
deprecationDate: "2024-01-15"
successorApi: "NewAPI v2.0"2. Artifact.json:
{
"changelog": [{
"state": "deprecated",
"date": "2024-01-15",
"version": "1.5.0",
"notes": "Deprecated. Use NewAPI v2.0. Migration guide: https://..."
}]
}3. Source Code (Java example):
/**
* Gets customer address.
*
* @deprecated As of version 1.5.0, replaced by
* {@link com.sap.newapi.Customer#getAddress()}
* Use the new API which provides enhanced address validation.
*/
@Deprecated
public Address getCustomerAddress() {
// implementation
}Step 3: Documentation Updates
1. API Reference:
- Add deprecation banner at top of page
- Include deprecation date and successor
- Link to migration guide
2. Release Notes:
- Announce deprecation
- Explain reason for deprecation
- Provide migration timeline
- Link to migration guide
3. Migration Guide:
- Document API differences
- Provide code examples
- Explain migration steps
- List breaking changes
Step 4: Communication
1. Announcement Channels:
- Release notes
- Blog posts
- Email to affected customers
- In-app notifications (if applicable)
2. Announcement Content:
- What is being deprecated
- Why it's being deprecated
- When it will be decommissioned
- What to use instead
- Where to find migration guidance
Step 5: Support Period
1. Maintain Support:
- Continue bug fixes
- Provide security patches
- Answer customer questions
- Monitor migration progress
2. Track Migration:
- Monitor API usage metrics
- Identify customers still using deprecated API
- Proactively contact stragglers
- Offer migration assistance
---
Decommission Process
Prerequisites
Before decommissioning, verify:
- [ ] Minimum 12 months since deprecation announcement
- [ ] Minimum 24 months total lifespan
- [ ] All customers notified
- [ ] Migration guidance published
- [ ] Successor API available and stable
- [ ] Remaining usage is minimal
Decommission Methods
Method 1: Remove Entire API Package
For complete API removal:
1. Delete artifact folder from repository 2. Commit and push changes 3. Republish to SAP API Business Hub (API will be removed)
Example:
# Remove the API directory
rm -rf apis/EmployeeManagement/1.0
# Commit removal
git add -A
git commit -m "Decommission EmployeeManagement API v1.0"
git pushMethod 2: Remove Specific Endpoints
For partial API removal:
1. Edit artifact.json 2. Remove specific endpoint definitions 3. Update changelog with decommission notice 4. Commit and push changes
Example (artifact.json):
{
"changelog": [
{
"state": "decommissioned",
"date": "2025-01-15",
"version": "1.5.0",
"notes": "Endpoint /legacy/customers decommissioned. Use /v2/customers instead."
}
],
"paths": {
"/v2/customers": { ... }
// Removed: "/legacy/customers"
}
}Post-Decommission Actions
1. Documentation Cleanup:
- Remove API from documentation site
- Archive old documentation
- Set up redirects to successor API
- Update navigation menus
2. URL Management:
- Configure HTTP 410 (Gone) responses for old endpoints
- Include message pointing to successor API
- Maintain redirects for reasonable period
3. Communication:
- Publish decommission announcement
- Send final notification to any remaining users
- Update status pages
---
Best Practices
Planning
1. Early Assessment: Evaluate deprecation candidates during product planning 2. Customer Impact: Always consider customer migration effort 3. Batch Deprecations: Group related API deprecations together 4. Version Strategy: Use semantic versioning to signal breaking changes
Communication
1. Multiple Channels: Announce through all available channels 2. Advance Notice: Provide notice well before minimum period 3. Clear Messaging: Explain what, why, when, and how 4. Regular Reminders: Send periodic reminders during deprecation period
Documentation
1. Prominent Warnings: Make deprecation notices highly visible 2. Complete Migration Guides: Don't just say "use X instead" - explain how 3. Code Examples: Provide before/after code comparisons 4. FAQs: Answer common migration questions
Technical
1. Graceful Degradation: Consider warning headers before hard removal 2. Usage Tracking: Monitor deprecated API usage 3. Migration Tools: Provide automated migration tools when feasible 4. Backward Compatibility: Maintain during deprecation period
---
Examples
Example 1: REST API Endpoint Deprecation
OpenAPI Specification:
openapi: 3.0.0
info:
title: Order Management API
version: 2.1.0
paths:
/orders/{orderId}:
get:
summary: Get order details
deprecated: true
description: |
**DEPRECATED**: This endpoint is deprecated as of January 15, 2024.
Use /v2/orders/{orderId} instead.
This endpoint will be decommissioned on January 15, 2025.
Migration guide: https://help.sap.com/order-api-migration
x-sap-stateInfo:
state: deprecated
deprecationDate: "2024-01-15"
successorApi: "/v2/orders/{orderId}"
responses:
'200':
description: Order details (deprecated)
headers:
Warning:
schema:
type: string
description: '299 - "Deprecated API. Use /v2/orders/{orderId}"'Example 2: Java Method Deprecation
/**
* Service for managing customer data.
*/
public class CustomerService {
/**
* Retrieves customer by ID.
*
* @param customerId the customer identifier
* @return customer object
* @throws NotFoundException if customer not found
* @deprecated As of version 2.0.0 (deprecated January 15, 2024),
* replaced by {@link #getCustomerById(String)}
* The new method provides enhanced validation and
* supports additional customer types.
* This method will be removed in version 3.0.0
* (scheduled for January 15, 2025).
* Migration guide: https://help.sap.com/customer-api-migration
*/
@Deprecated(since = "2.0.0", forRemoval = true)
public Customer getCustomer(int customerId) throws NotFoundException {
// Legacy implementation
return legacyCustomerRetrieval(customerId);
}
/**
* Retrieves customer by ID with enhanced validation.
*
* @param customerId the customer identifier (supports all formats)
* @return customer object
* @throws NotFoundException if customer not found
* @throws ValidationException if customerId format invalid
* @since 2.0.0
*/
public Customer getCustomerById(String customerId)
throws NotFoundException, ValidationException {
// New implementation
return enhancedCustomerRetrieval(customerId);
}
}Example 3: Complete API Deprecation Timeline
Timeline: Document Management API
2022-01-01: API v1.0.0 released (active)
├─ State: active
├─ Full support and SLAs
└─ Production-ready
2023-06-15: API v2.0.0 released
├─ Enhanced features
├─ Better performance
└─ v1.0.0 remains active
2024-01-15: API v1.0.0 deprecated
├─ State: deprecated
├─ Deprecation announcement published
├─ Migration guide released
├─ Support continues
└─ x-sap-stateInfo updated
2024-07-15: 6-month reminder
├─ Email to remaining v1.0.0 users
├─ 6 months until decommission
└─ Migration assistance offered
2024-10-15: 3-month reminder
├─ Final migration push
├─ Direct contact to high-usage customers
└─ Migration tools provided
2025-01-15: API v1.0.0 decommissioned
├─ State: decommissioned
├─ Endpoints return HTTP 410 Gone
├─ Documentation removed
├─ Redirects to v2.0.0 documentation
└─ Final announcement published
Total Timeline:
- Active period: 24 months (Jan 2022 - Jan 2024)
- Deprecated period: 12 months (Jan 2024 - Jan 2025)
- Total lifespan: 36 months ✓ (exceeds 24-month minimum)
- Support after deprecation: 12 months ✓ (meets minimum)---
Reference
External Standards
- OpenAPI Specification: https://spec.openapis.org/oas/latest.html
- Semantic Versioning: https://semver.org/
- HTTP Status Codes: https://httpstatuses.com/
SAP Resources
- SAP API Business Hub: https://api.sap.com/
- SAP Help Portal: https://help.sap.com/
Related Documentation
- API Naming Guidelines
- API Quality Checklist
- API Review Process
- Developer Guide Standards
---
Document Version: 1.0.0 Last Updated: 2025-11-21 Maintainer: SAP Skills Team | https://github.com/secondsky/sap-skills
Developer and Service Guides
Source: https://github.com/SAP-docs/api-style-guide/tree/main/docs/60-developer-or-service-guide Last Verified: 2025-11-21
Attribution: Content derived from SAP API Style Guide (Licensed under CC BY 4.0)
Changes: Consolidated from multiple source files, reorganized for progressive disclosure, added examples and templates.
---
Table of Contents
1. Overview 2. Purpose and Scope 3. Content Structure Guidelines 4. Topic Types and Conventions 5. Content Selection Guidelines 6. Code Sample Standards 7. Best Practices 8. Examples
---
Overview
Developer and service guides are supplementary resources that explain how to use APIs, SDKs, and development platforms alongside API references.
Relationship to API Reference Documentation
| Documentation Type | Purpose | Content |
|---|---|---|
| API Reference | Technical specification | Auto-generated docs, parameters, responses, methods |
| Developer Guide | Practical usage | Concepts, tutorials, scenarios, best practices |
Key Principle: Developer guides complement API references by providing context, examples, and practical guidance that cannot be auto-generated.
---
Purpose and Scope
What Developer Guides Include
1. Conceptual Information
- Goal, scope, and capabilities of an API
- Architectural diagrams explaining API structure
- System context and integration points
- Business scenarios and use cases
2. Code Quality Practices
- Secure programming guidelines
- Resilience patterns and error handling
- Performance optimization techniques
- Best practices for API consumption
3. Access & Setup
- Security requirements and authentication
- Initial setup and configuration
- Environment preparation
- Prerequisites and dependencies
4. Practical Usage
- Typical tasks and scenarios
- Workflows combining multiple API calls
- Sample code and tutorials
- Common integration patterns
Variability Across Products
Developer guides vary significantly in:
- Scope: From single API to entire platform
- Complexity: From simple tutorials to comprehensive system documentation
- Depth: From quick-start guides to architectural deep-dives
- Audience: From beginners to advanced developers
Important Note: Due to this variability, a one-size-fits-all standard is impractical. These guidelines provide flexible frameworks that technical writers adapt based on product needs and target audience.
---
Content Structure Guidelines
Fundamental Information Design
Developer guides should follow these structural principles:
1. Separation by Type
- Separate chapters for concepts, tasks, and reference material
- Clear boundaries between information types
- Logical progression from concepts → tasks → reference
2. Task-Oriented Approach
- Enable rapid developer task completion
- Focus on practical outcomes
- "How do I...?" questions should be easily answerable
3. Consistent Title Conventions
- Use standardized titling patterns (see Topic Types below)
- Maintain consistency throughout documentation
- Make topics easily scannable
---
Topic Types and Conventions
Topic Type Matrix
| Type | Purpose | Title Format | Example | Content |
|---|---|---|---|---|
| Concept | Introductions, overviews, background information | Noun phrase | "SAP HANA Cloud", "OAuth 2.0 Authentication" | Explains what something is, why it matters, how it works |
| Reference | API documentation, tables, specifications, syntax | Noun phrase | "SAP HANA Cloud JavaScript Reference", "API Endpoints" | Lists methods, parameters, configuration options |
| Complex Task | Tutorials, multi-step procedures with code | Gerund phrase (-ing) | "Developing SAP HANA Cloud Applications", "Building a Fiori App" | Step-by-step tutorials with code samples |
| Detailed Task | Single tasks with code samples | Gerund phrase (-ing) | "Creating an Application Project", "Configuring OAuth" | Specific how-to instructions |
Title Examples by Type
Concept Topics:
- ✅ "API Authentication Overview"
- ✅ "Understanding OData Query Options"
- ✅ "SAP Cloud Platform Architecture"
- ❌ "How to Understand OAuth" (task format for concept)
Reference Topics:
- ✅ "Environment Variables Reference"
- ✅ "Configuration Parameters"
- ✅ "Error Code Catalog"
- ❌ "Configuring Environment Variables" (task format for reference)
Task Topics:
- ✅ "Implementing OAuth 2.0 Authentication"
- ✅ "Creating Your First API Request"
- ✅ "Deploying to Cloud Foundry"
- ❌ "OAuth Implementation" (noun phrase for task)
---
Content Selection Guidelines
Collaborate with Product Owners
Key Principle: "Don't try to cover all of the APIs in your product."
Work with product teams to: 1. Identify Priority APIs: Focus on most commonly used or business-critical APIs 2. Define Key Use Cases: Document typical scenarios, not every possibility 3. Target Audience Needs: Write for your primary developer persona 4. Balance Coverage vs. Depth: Deep coverage of important topics beats shallow coverage of everything
Content Scope Decisions
Include:
- ✅ Customer-relevant information
- ✅ Business scenarios and use cases
- ✅ Integration patterns and workflows
- ✅ Authentication and security guidance
- ✅ Error handling patterns
- ✅ Performance best practices
- ✅ Migration guides for version changes
Exclude:
- ❌ Internal implementation details
- ❌ Duplicate SAP API Business Hub information
- ❌ Every possible API method (focus on common ones)
- ❌ Internal architecture not relevant to consumers
- ❌ Debugging information for SAP internal teams
Depth vs. Breadth
Guideline: "Don't write a novel, keep the topics short and concise."
- Short Topics: 300-800 words for most topics
- Long Tutorials: 1000-2000 words maximum
- Complex Topics: Break into smaller, manageable subtopics
- Progressive Disclosure: Link to detailed information rather than including everything
Diagram Guidelines
Use Clear Diagrams:
- Avoid excessive complexity
- Remove internal-only information
- Adapt internal architectural diagrams for external audiences
- Focus on customer-relevant flows and interactions
Avoid Redundancy:
- Don't duplicate diagrams unnecessarily
- Use one clear diagram instead of multiple similar ones
- Reference existing diagrams when appropriate
---
Code Sample Standards
Quality Requirements
All code samples must meet these criteria:
1. Compilable Without Errors
Requirement: "Must compile without errors"
- Test all code before publication
- Verify with actual compiler/interpreter
- Include necessary imports and dependencies
- Handle version-specific syntax
Bad Example ❌:
// This won't compile - missing imports
Customer customer = getCustomer();Good Example ✅:
import com.sap.customer.Customer;
import com.sap.customer.CustomerService;
CustomerService service = new CustomerService();
Customer customer = service.getCustomer("12345");2. Concise and Focused
Requirement: "Concise, containing only API-relevant code"
- Show only code necessary to demonstrate the concept
- Remove boilerplate unrelated to the API
- Focus on the API call itself and essential context
Bad Example ❌:
public class CustomerExample {
private static final Logger logger = LogManager.getLogger();
private Configuration config;
private MetricsCollector metrics;
public CustomerExample() {
this.config = new Configuration();
this.metrics = new MetricsCollector();
logger.info("Initializing example...");
}
public void demonstrateAPI() {
logger.debug("Starting API call");
metrics.startTimer();
try {
// Actual API usage buried in boilerplate
Customer customer = api.getCustomer("12345");
logger.debug("Customer retrieved: " + customer.getName());
} catch (Exception e) {
logger.error("Failed", e);
metrics.recordError();
} finally {
metrics.stopTimer();
}
}
}Good Example ✅:
// Get a customer by ID
Customer customer = api.getCustomer("12345");
System.out.println("Customer: " + customer.getName());
// Error handling
try {
customer = api.getCustomer("invalid");
} catch (NotFoundException e) {
System.out.println("Customer not found");
}3. Sufficient Comments
Requirement: "Include sufficient comments for clarity"
- Explain why, not just what
- Comment complex logic or API-specific requirements
- Don't over-comment obvious code
Bad Example ❌:
// Create customer service
CustomerService service = new CustomerService();
// Get customer
Customer customer = service.getCustomer("12345");
// Print customer name
System.out.println(customer.getName());Good Example ✅:
// Initialize service with default authentication
CustomerService service = new CustomerService();
// Retrieve customer by SAP customer number
// Note: Customer ID must be numeric string format
Customer customer = service.getCustomer("12345");
// Display full legal name (formatted by locale)
System.out.println(customer.getName());4. Easy Copy-Paste
Requirement: "Enable easy copy-paste into code editors"
- Use standard formatting (not proprietary)
- Include necessary context (imports, variables)
- Avoid line breaks in strings when possible
- Use consistent indentation
Bad Example ❌:
Customer customer = api.
getCustomer(
"12345"
); // Awkward formattingGood Example ✅:
Customer customer = api.getCustomer("12345");Code Sample Patterns
Pattern 1: Basic API Call
// Simple GET request example
const response = await fetch('https://api.sap.com/customers/12345', {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
});
const customer = await response.json();
console.log(customer);Pattern 2: Error Handling
try {
Customer customer = service.getCustomer(customerId);
processCustomer(customer);
} catch (NotFoundException e) {
// Customer doesn't exist - handle gracefully
logger.warn("Customer not found: " + customerId);
return Optional.empty();
} catch (UnauthorizedException e) {
// Authentication failed - refresh token
refreshAuthToken();
return getCustomerWithRetry(customerId);
}Pattern 3: Complete Workflow
# Complete workflow: Authenticate, retrieve, update customer
# Step 1: Authenticate
auth_token = authenticate(api_key, secret)
# Step 2: Retrieve customer data
customer = api.get_customer(
customer_id="12345",
auth_token=auth_token
)
# Step 3: Update customer information
customer['email'] = 'new.email@example.com'
# Step 4: Save changes
result = api.update_customer(
customer_id="12345",
data=customer,
auth_token=auth_token
)
print(f"Update successful: {result['status']}")---
Best Practices
1. Progressive Learning
Structure content for developers at different skill levels:
Beginner Level:
- Quick start guides
- Simple, complete examples
- Step-by-step tutorials
- Heavy use of code samples
Intermediate Level:
- Common integration patterns
- Best practices
- Error handling strategies
- Performance optimization
Advanced Level:
- Complex workflows
- Custom extensions
- Advanced configuration
- Architecture patterns
2. Practical Focus
Emphasize:
- Real-world scenarios
- Working code examples
- Common pitfalls and solutions
- Typical workflows
De-emphasize:
- Theoretical concepts without application
- Every possible parameter combination
- Rarely-used features
- Internal implementation details
3. Tutorial Format for Complex Tasks
For complex multi-step processes:
1. Break into Smaller Subtopics: Each subtopic covers one logical step 2. Clear Prerequisites: State what readers need before starting 3. Expected Outcomes: Show what success looks like 4. Troubleshooting: Include common issues and solutions
Example Structure:
Tutorial: Building Your First Fiori Application
├── Prerequisites
│ ├── Required tools
│ ├── Account setup
│ └── Sample data
├── Part 1: Creating the Project
│ ├── Initialize project
│ ├── Configure manifest
│ └── Verify setup
├── Part 2: Building the UI
│ ├── Create view
│ ├── Add controls
│ └── Test locally
├── Part 3: Adding Data Binding
│ ├── Configure OData service
│ ├── Bind to controls
│ └── Test with real data
├── Part 4: Deployment
│ ├── Build for production
│ ├── Deploy to Cloud
│ └── Verify deployment
└── Troubleshooting
├── Common build errors
├── Connection issues
└── Getting help4. Avoid Duplication with API Business Hub
Don't Duplicate:
- ❌ API endpoint listings (available in API Business Hub)
- ❌ Parameter descriptions (auto-generated)
- ❌ Response schema definitions
Do Provide:
- ✅ Deeper analysis of when to use which endpoint
- ✅ Integration patterns combining multiple endpoints
- ✅ Business context for API usage
- ✅ Migration guides and version comparisons
5. Maintain and Update
- Regular Reviews: Update guides when APIs change
- Version Notices: Clearly indicate which API version guide applies to
- Deprecation Warnings: Mark outdated content prominently
- Feedback Loops: Collect and incorporate developer feedback
---
Examples
Example 1: Concept Topic
Title: "Understanding SAP OAuth 2.0 Authentication"
Structure:
# Understanding SAP OAuth 2.0 Authentication
## What is OAuth 2.0?
OAuth 2.0 is an authorization framework that enables applications
to obtain limited access to user accounts on SAP services.
## Why Use OAuth 2.0?
- **Security**: Never expose user passwords to third-party applications
- **Limited Access**: Grant specific permissions, not full account access
- **Revocable**: Users can revoke access anytime
- **Standard**: Industry-standard protocol supported across SAP services
## How It Works
[Diagram: OAuth 2.0 Flow]
1. Application requests authorization
2. User grants permission
3. Application receives access token
4. Application uses token to access resources
## Grant Types
SAP supports three OAuth 2.0 grant types:
### Authorization Code (Recommended)
Best for server-side web applications...
### Client Credentials
Best for machine-to-machine communication...
### Refresh Token
Used to obtain new access tokens...
## Next Steps
- [Implementing OAuth 2.0 Authentication](#) (Task Guide)
- [OAuth Configuration Reference](#) (Reference)Example 2: Task Topic
Title: "Implementing OAuth 2.0 Client Credentials Flow"
Structure:
# Implementing OAuth 2.0 Client Credentials Flow
This guide shows how to implement OAuth 2.0 authentication using
the Client Credentials grant type for server-to-server communication.
## Prerequisites
- SAP BTP account
- OAuth client ID and secret
- Node.js 14+ installed
## Step 1: Obtain Client Credentials
1. Log in to SAP BTP Cockpit
2. Navigate to Security → OAuth Clients
3. Click "Create New Client"
4. Copy client ID and secret
## Step 2: Request Access Token
const fetch = require('node-fetch');
async function getAccessToken() { const credentials = Buffer.from( ${CLIENT_ID}:${CLIENT_SECRET} ).toString('base64');
const response = await fetch('https://auth.sap.com/oauth/token', { method: 'POST', headers: { 'Authorization': Basic ${credentials}, 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'grant_type=client_credentials&scope=read write' });
const data = await response.json(); return data.access_token; }
## Step 3: Use Token for API Requests
async function callAPI() { const token = await getAccessToken();
const response = await fetch('https://api.sap.com/resource', { headers: { 'Authorization': Bearer ${token} } });
return await response.json(); }
## Step 4: Handle Token Expiration
Tokens expire after 1 hour. Implement token refresh:
let cachedToken = null; let tokenExpiry = null;
async function getValidToken() { const now = Date.now();
// Return cached token if still valid if (cachedToken && tokenExpiry > now) { return cachedToken; }
// Request new token cachedToken = await getAccessToken(); tokenExpiry = now + (3600 * 1000); // 1 hour
return cachedToken; }
## Troubleshooting
### "Invalid client credentials"
- Verify client ID and secret are correct
- Ensure credentials are base64 encoded properly
### "Insufficient scope"
- Check that your OAuth client has required scopes
- Request appropriate scopes in token request
## Next Steps
- [OAuth 2.0 Best Practices](#)
- [Authorization Code Flow](#)
- [Token Management Strategies](#)Example 3: Reference Topic
Title: "OAuth Configuration Parameters"
Structure:
# OAuth Configuration Parameters
Complete reference for OAuth 2.0 configuration options.
## Token Endpoint
**URL**: `https://auth.sap.com/oauth/token`
## Request Parameters
| Parameter | Required | Description | Example |
|-----------|----------|-------------|---------|
| `grant_type` | Yes | OAuth grant type | `client_credentials` |
| `client_id` | Yes | OAuth client identifier | `sb-client-12345` |
| `client_secret` | Yes | OAuth client secret | `abc123...` |
| `scope` | No | Requested permissions | `read write` |
## Response Format
{ "access_token": "eyJhbGc...", "token_type": "Bearer", "expires_in": 3600, "scope": "read write" }
## Error Codes
| Code | Description | Resolution |
|------|-------------|------------|
| `invalid_client` | Invalid credentials | Verify client ID/secret |
| `invalid_grant` | Grant type not supported | Use supported grant type |
| `invalid_scope` | Scope not available | Request valid scopes |---
Reference
SAP Resources
- SAP Help Portal: https://help.sap.com/
- SAP API Business Hub: https://api.sap.com/
- SAP Community: https://community.sap.com/
Related Documentation
- API Reference Documentation Standards
- API Quality Checklist
- Code Sample Guidelines
---
Document Version: 1.0.0 Last Updated: 2025-11-21 Maintainer: SAP Skills Team | https://github.com/secondsky/sap-skills
Glossary and External Resources
Source: https://github.com/SAP-docs/api-style-guide/ Last Verified: 2025-11-21
Attribution: Content derived from SAP API Style Guide (Licensed under CC BY 4.0)
Changes: Consolidated from multiple source files, reorganized for progressive disclosure, added examples and templates.
---
Table of Contents
1. Glossary 2. External Resources 3. SAP-Specific Resources 4. Quick Reference
---
Glossary
A
API (Application Programming Interface) An interface provided by an application for interacting with other applications. Enables software programs to exchange information across organizational boundaries by selectively exposing functionality.
API Documentation Comment Combines descriptions and block tags in source code for generating API reference documentation. Used by documentation generators like Javadoc, JSDoc, and Doxygen.
API Documentation Generators Tools like Javadoc, JSDoc, Doxygen, and Swagger that extract comments from source code and produce structured documentation.
C
Code Sample File A complete, working example demonstrating API features that ships with SDKs. More comprehensive than code snippets, showing real-world implementation patterns.
Code Snippet Several lines of code illustrating API method usage. Typically embedded in documentation to demonstrate specific functionality.
Component (OpenAPI) Reusable object definitions in OpenAPI Specification 3.0+ (called "Definitions" in version 2.0). Includes schemas, parameters, responses, examples, etc.
D
Decommissioned APIs that have been fully retired and cannot be used in production. Final state in API lifecycle.
Definition (OpenAPI) See Component. Term used in OpenAPI Specification 2.0 for reusable objects.
Demo Application A basic implementation provided with SDKs showing main API capabilities and typical usage patterns.
Deprecated API elements no longer supported in future releases, marked with the x-sap-stateInfo attribute or @deprecated tag. Not encouraged for use but still functional.
Documentation Tag Special marker instructing documentation generators how to format comment sections. Examples: @param, @return, <summary>, \file.
E
Entity (OData) Typed data object in OData Entity Data Model (EDM). Examples: Customer, Employee, Order.
Entity Data Model (EDM) Structured data description in OData protocol defining entities, entity sets, relationships, and operations.
Entity Set (OData) Named collection of entities. Example: "Customers" is an entity set containing Customer entities.
Exception Documented errors occurring during method execution, typically using @throws, @exception, or <exception> tags.
M
Metadata (OData) XML document describing the structure of an OData service. Accessible at $metadata endpoint (e.g., https://api.sap.com/odata/$metadata`).
O
OData (Open Data Protocol) A REST-based protocol for querying and updating data, built on HTTP, Atom/XML, and JSON standards. Maintained by OASIS Open.
Operation (REST/OData) HTTP method (GET, PUT, POST, DELETE, PATCH) for manipulating endpoints or performing actions on resources.
OpenAPI Specification Community-driven open specification for RESTful APIs under the OpenAPI Initiative. Version 3.0.3 is current standard.
P
Parameter Option passed with a path, such as filtering criteria, sorting options, or pagination controls. Can appear in path, query, header, body, or formData.
Partner APIs APIs created by SAP partners for customers, published on the SAP API Business Hub.
Path (REST/OData) Endpoint or resource in API URLs. Examples: /users, /users/{id}, /orders/{orderId}/items.
Private APIs APIs restricting access to vendors, partners, or selected customers. Not publicly available.
Public APIs APIs available in the public domain that become vendor-client contracts. Require careful versioning and deprecation management.
R
Resource (REST/OData) Concept or object that users want to control through HTTP requests. Identified by URIs and manipulated using HTTP methods.
Response HTTP status code combined with outcome description, optionally including response body with data or error information.
REST API (Representational State Transfer) Architectural style enabling cross-platform CRUD operations over HTTP. Focuses on resources rather than actions.
Return Type/Value Data returned by methods, documented using @return, @returns, or <returns> tags.
S
Schema (OpenAPI) Data structure definition describing request/response formats. Defines properties, types, required fields, and validation rules.
SPI (Service Provider Interface) Vendor-defined interface intended for third-party implementation, extending or customizing API functionality.
X
x-sap-stateInfo SAP-specific OpenAPI extension attribute defining API lifecycle state: beta, active, deprecated, or decommissioned.
---
External Resources
API Standards & Specifications
OpenAPI Specification
URL: https://spec.openapis.org/oas/latest.html
Description: The standard for RESTful APIs. A community-driven open specification within the OpenAPI Initiative for describing HTTP APIs in a machine-readable format.
Use For:
- REST API specification structure
- OpenAPI document format
- API schema definitions
- Operation documentation
Current Version: 3.0.3 (3.1.0 available)
OData Specification
URL: https://www.odata.org/documentation/
Description: The standard for OData maintained by OASIS Open. Defines protocol for querying and updating data over HTTP.
Use For:
- OData service structure
- EDM (Entity Data Model) design
- Query operation syntax
- OData conventions
Supported Versions: 4.01, 3.0, 2.0
Documentation Tools
Java - Javadoc
URL: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
Description: Oracle's guidance on "How to Write Doc Comments for the Javadoc Tool" through their Technology Network.
Use For:
- Java API documentation
- Javadoc tag reference
- Documentation comment format
- Tool usage and configuration
Official Oracle Reference: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html
JavaScript - JSDoc
URL: https://jsdoc.app/
Description: JSDoc 3 documentation generator available on GitHub. Comprehensive tag reference and examples.
Use For:
- JavaScript API documentation
- JSDoc tag syntax
- TypeScript documentation
- Node.js project documentation
Tag Reference: https://jsdoc.app/index.html#block-tags
Markdown Support: https://jsdoc.app/about-including-markdown.html
Microsoft .NET
C# XML Documentation URL: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/
Description: Microsoft's official guidance for C# XML documentation comments.
Use For:
- .NET API documentation
- XML comment syntax
- Visual Studio integration
- IntelliSense support
.NET Naming Guidelines URL: https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines
Description: Microsoft's official naming conventions for .NET libraries.
Use For:
- .NET naming standards
- PascalCase/camelCase usage
- Namespace organization
- Framework design guidelines
C/C++ - Doxygen
Description: Documentation generator supporting multiple languages including C++, C#, PHP, Java, and Python.
Use For:
- C/C++ API documentation
- Multi-language documentation
- Diagram generation
- Cross-platform documentation
Manual: https://www.doxygen.nl/manual/
Python - Sphinx
URL: https://www.sphinx-doc.org/
Description: Documentation generator for Python with reStructuredText support.
Use For:
- Python API documentation
- Python package documentation
- Technical documentation
- ReadTheDocs integration
SAP-Specific Resources
SAP API Business Hub
URL: https://api.sap.com/
Description: Central repository for SAP's REST and OData API references. Provides interactive API exploration, testing, and documentation.
Use For:
- Publishing REST/OData APIs
- Discovering SAP APIs
- Testing API endpoints
- Downloading API specifications
Login Required: SAP account needed for full access
SAP Help Portal
Description: Comprehensive SAP product documentation and help resources.
Use For:
- Product documentation
- Technical guides
- Configuration guides
- Release notes
SAP Developer Center
URL: https://developers.sap.com/
Description: Resources for SAP developers including tutorials, code samples, and developer guides.
Use For:
- Getting started tutorials
- Code samples
- Developer community
- Learning paths
Tutorial Navigator: https://developers.sap.com/tutorial-navigator.html
SAP Community
URL: https://community.sap.com/
Description: SAP's community platform for asking questions, sharing knowledge, and connecting with other developers.
Use For:
- Community support
- Best practices
- Code sharing
- Networking
SAP Business Accelerator Hub (formerly API Business Hub)
URL: https://api.sap.com/
Description: Updated name for SAP API Business Hub. Provides APIs, events, and integrations.
Use For:
- API discovery and exploration
- Integration content
- Pre-built integrations
- API package management
---
SAP-Specific Resources
SAP API Style Guide Repository
URL: https://github.com/SAP-docs/api-style-guide
Description: Official SAP API Style Guide source repository containing all documentation standards.
Contents:
- API naming guidelines
- REST/OData documentation standards
- Java/JavaScript/.NET documentation
- Manual template guidelines
- Deprecation policy
- Quality processes
Last Updated: 2021.01
Clone Command:
git clone https://github.com/SAP-docs/api-style-guide.gitSAP BTP (Business Technology Platform)
Cockpit: https://cockpit.sap.com/
Documentation: https://help.sap.com/docs/BTP
API Documentation: Available through SAP API Business Hub
SAP Integration Suite
URL: https://help.sap.com/docs/INTEGRATION_SUITE
Includes:
- API Management
- Integration Advisor
- Open Connectors
- API Designer (bundled with Integration Suite)
Use For:
- Creating and managing APIs
- API design and development
- Integration patterns
- API lifecycle management
SAP NetWeaver
JavaScript API Example: Available through SAP NetWeaver documentation
URL: https://help.sap.com/docs/SAP_NETWEAVER
Use For:
- JavaScript API patterns
- NetWeaver-specific documentation
- Portal development
---
Quick Reference
By Language/Technology
| Language/Tech | Standard | Tool | Documentation |
|---|---|---|---|
| Java | Javadoc | javadoc | Oracle Javadoc |
| JavaScript | JSDoc 3 | jsdoc | JSDoc |
| .NET (C#) | XML Comments | DocFX, Sandcastle | Microsoft XML Docs |
| C/C++ | Doxygen | doxygen | Doxygen Manual |
| Python | reStructuredText | Sphinx | Sphinx |
| REST | OpenAPI | Swagger, Redoc | OpenAPI Spec |
| OData | OData 4.01 | Various | OData.org |
By Documentation Type
| Documentation Type | Primary Resource | Secondary Resource |
|---|---|---|
| REST API Reference | OpenAPI Spec | SAP API Business Hub |
| OData API Reference | OData Spec | SAP API Business Hub |
| Java API Reference | Javadoc Guide | SAP Naming Guidelines |
| JavaScript API Reference | JSDoc Guide | SAP Naming Guidelines |
| .NET API Reference | Microsoft XML Docs | SAP Naming Guidelines |
| Developer Guides | SAP Developer Center | SAP Help Portal |
| Tutorials | SAP Tutorial Navigator | SAP Community |
| Code Samples | SAP API Business Hub | GitHub |
By Task
| Task | Resource | URL |
|---|---|---|
| Find SAP APIs | SAP API Business Hub | https://api.sap.com/ |
| Learn SAP Development | SAP Developer Center | https://developers.sap.com/ |
| Read Product Docs | SAP Help Portal | https://help.sap.com/ |
| Ask Questions | SAP Community | https://community.sap.com/ |
| Design REST APIs | OpenAPI Spec | https://spec.openapis.org/ |
| Design OData APIs | OData Spec | https://www.odata.org/ |
| Write Java Docs | Javadoc Guide | https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html |
| Write JS Docs | JSDoc Guide | https://jsdoc.app/ |
| Write .NET Docs | Microsoft Docs | https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/ |
| Generate C++ Docs | Doxygen | https://www.doxygen.nl/ |
---
Version Information
API Standard Versions
| Standard | Current Version | Previous Versions | Status |
|---|---|---|---|
| OpenAPI | 3.0.3 | 2.0 (Swagger), 3.1.0 | Active |
| OData | 4.01 | 4.0, 3.0, 2.0 | Active |
| Javadoc | Java 17 | Java 8, 11 | Active |
| JSDoc | 3.x | 2.x | Active |
| .NET XML | .NET 6+ | .NET Framework, .NET Core | Active |
| Doxygen | 1.9+ | 1.8.x | Active |
SAP API Style Guide Versions
| Version | Date | Key Changes |
|---|---|---|
| 2021.01 | January 2021 | API Designer clarification, expanded description guidelines |
| Initial | Earlier | Base standards established |
---
Related SAP Documentation
Official SAP Standards Documents
1. SAP API Style Guide - This complete skill reference 2. SAP Naming Conventions - naming-conventions.md 3. SAP Quality Processes - quality-processes.md 4. SAP Deprecation Policy - deprecation-policy.md 5. SAP Developer Guides - developer-guides.md
SAP Cloud Documentation
- SAP BTP: https://help.sap.com/docs/BTP
- SAP Cloud Foundry: https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/
- SAP Kyma: https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/
SAP Development Tools
- SAP Business Application Studio: https://help.sap.com/docs/BAS
- SAP Web IDE: (Deprecated - migrating to Business Application Studio)
- SAP HANA Cloud: https://help.sap.com/docs/HANA_CLOUD
---
Document Version: 1.0.0 Last Updated: 2025-11-21 Maintainer: SAP Skills Team | https://github.com/secondsky/sap-skills
OData Operation Template
How to Use This Template
Purpose: Document individual OData operations (CRUD, functions, actions) with complete request/response details.
When to Use:
- Creating detailed documentation for a specific OData operation
- Documenting CRUD operations with full request/response examples
- Documenting custom functions and actions
- Detailed operation documentation linked from Resource template
Instructions: 1. Replace all [bracketed text] with your actual operation information 2. Include complete, working HTTP request examples 3. Show real response examples with actual data and status codes 4. Document all possible status codes for this specific operation 5. Include both success and error response examples 6. Test the operation and verify all examples work 7. Remove optional sections if not applicable
Cross-Reference: Use with OData Resource Template for resource context and OData Service Overview Template for service-level info.
Template Structure:
- Title & Introduction
- Operation Details (type, HTTP method, permission)
- Request (headers, parameters, body, examples)
- Response (headers, status codes, body, examples)
---
[Operation Name] ([HTTP Method])
[Provide comprehensive description of what this operation does. Include:
- What action is performed
- What is returned (if applicable)
- When to use this operation
- Important behaviors or side effects]
Example: "Creates a new employee record in the system with provided information. Automatically assigns unique employee ID and initializes default values (status: ACTIVE, creation timestamp). Triggers HR workflow notifications."
---
Usage
[Explain when and why to use this operation, including:
- Primary use cases and scenarios
- When to use alternative operations
- Important prerequisites or constraints
- Any special behaviors or workflows]
Use this operation to [describe scenario].
Key points:
- [Important characteristic or constraint]
- [Related operation if applicable]
- [Performance consideration if relevant]
- [Workflow impact or side effect if relevant]
Example: "Use this operation when adding a new employee to the system. Required fields include first name, last name, email, and department. Optional fields like hire date and salary can be provided.
Key points:
- Automatically generates unique EmployeeID
- Email must be unique across system
- Returns created employee in response body (if Prefer header included)
- Triggers HR workflow notifications to department manager
- Related operations: PATCH for updates, GET for retrieval"
---
Request
Operation Details
URI: [HTTP Method] [Path]
Example: POST /Employees, GET /Employees('E12345'), PATCH /Employees('E12345')
Operation Type: [CRUD/Function/Action]
| Aspect | Value |
|---|---|
| HTTP Method | [GET/POST/PUT/PATCH/DELETE] |
| Operation Type | [CRUD (standard)/Function (returns data)/Action (performs action)] |
| Resource | [Resource name] |
| Full URI Pattern | [Complete URI pattern with placeholders] |
Example:
| Aspect | Value |
|---|---|
| HTTP Method | POST |
| Operation Type | CRUD (Create) |
| Resource | Employees |
| Full URI Pattern | POST /Employees |Required Permission
Permission: [Required role or permission level]
[Explanation of what this permission allows and why it's required]
Example: "Permission: ROLE_HR_MANAGER or ROLE_ADMIN
Only users with ROLE_HR_MANAGER or higher role can create employees. Lower roles like ROLE_HR_USER cannot call this operation."
Request Headers
| Header Name | Required | Possible Values | Description |
|---|---|---|---|
| [Header] | [Yes/No] | [Values] | [Description with format/examples] |
Example:
| Header Name | Required | Possible Values | Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | OAuth2 authentication token. Format: Bearer {token}. Required for all operations. |
| Content-Type | Yes (POST/PUT/PATCH) | application/json | Media type of request body. Required for operations with request body. Value: application/json |
| Accept | No | application/json | Preferred response format. Default: application/json. Optional: specify other formats if supported. |
| Prefer | No | return=representation, return=minimal | OData preference. return=representation: include created/updated entity in response. return=minimal: response without body (faster). |
| If-Match | No | {ETag} | ETag for optimistic concurrency control. Format: quoted string (e.g., "abc123"). Required for safe concurrent updates on PUT/PATCH. |
| X-Request-ID | No | UUID | Optional request tracking ID. Format: any valid UUID. Example: 123e4567-e89b-12d3-a456-426614174000 |Request Parameters
[Document all parameters passed to the operation, organized by location.]
Path Parameters
[If operation uses path parameters in URI]
| Parameter Name | Requirement | Data Type | Description | Location |
|---|---|---|---|---|
| [Name] | Required/Optional | [Type] | [Description with constraints, pattern, valid values] | Path |
Example:
| Parameter Name | Requirement | Data Type | Description | Location |
|---|---|---|---|---|
| EmployeeID | Required | String | Employee unique identifier. Pattern: E[0-9]{5}. Example: "E12345" | Path |Query Parameters
[If operation uses query parameters]
| Parameter Name | Requirement | Data Type | Description | Location |
|---|---|---|---|---|
| $filter | Optional | String | OData filter expression for query. Example: FirstName eq 'John'. Used only in GET collection operations. | Query |
| $orderby | Optional | String | Sort order. Example: HireDate desc, LastName asc. Used in GET collection operations. | Query |
| $top | Optional | Integer | Maximum records to return (1-1000). Default: 50. Used for pagination. | Query |
| $skip | Optional | Integer | Records to skip for pagination. Default: 0. Used with $top. | Query |
| $select | Optional | String | Properties to include in response. Example: FirstName,LastName,Email. Reduces payload size. | Query |
| $expand | Optional | String | Navigate relationships and include related data. Example: Department,Manager. Limited to 3 levels deep. | Query |
Detailed Example for POST:
[No query parameters for POST operations - all data in request body]Detailed Example for GET with Collection:
| Parameter Name | Requirement | Data Type | Description | Location |
|---|---|---|---|---|
| $filter | Optional | String | Filter expression. Example: $filter=Status eq 'ACTIVE' and Salary gt 100000 | Query |
| $orderby | Optional | String | Sort fields. Example: $orderby=HireDate desc,LastName asc | Query |
| $top | Optional | Integer | Max results (1-1000, default: 50). Example: $top=100 | Query |
| $skip | Optional | Integer | Records to skip for pagination. Example: $skip=200 | Query |
| $select | Optional | String | Properties to include. Example: $select=FirstName,LastName,Email | Query |
| $expand | Optional | String | Include related data. Example: $expand=Department,Manager | Query |
| $count | Optional | Boolean | Include total count. Returns entities with @odata.count. Value: true. Example: ?$count=true. Note: Path /Employees/$count returns only integer count. | Query |Request Body
[For POST/PUT/PATCH operations with request body]
Format: [JSON structure with all properties]
Required Fields: [List of required fields]
Optional Fields: [List of optional fields]
| Property Name | Requirement | Data Type | Description | Constraints |
|---|---|---|---|---|
| [Property] | Required/Optional | [Type] | [Description] | [Min/max, format, valid values] |
Example:
Request body structure:
{
"FirstName": "string",
"LastName": "string",
"Email": "string",
"Department": "string",
"HireDate": "date",
"Salary": "decimal"
}
Required Fields: FirstName, LastName, Email, Department
Optional Fields: HireDate, Salary
| Property Name | Requirement | Data Type | Description | Constraints |
|---|---|---|---|---|
| FirstName | Required | String | Employee's first name | 1-50 characters, alphanumeric + spaces |
| LastName | Required | String | Employee's last name | 1-50 characters, alphanumeric + spaces |
| Email | Required | String | Corporate email address | Must be unique, valid email format (RFC 5322) |
| Department | Required | String | Department code | Valid: "SALES", "ENGINEERING", "FINANCE", "HR", "OPERATIONS" |
| HireDate | Optional | Date | Hire date in YYYY-MM-DD format | Cannot be future date, ISO 8601 format |
| Salary | Optional | Decimal | Annual salary in USD | Minimum: 20000, maximum: 10000000, 2 decimal places |Request Example
[Provide complete, working HTTP request with all headers and body.]
Template:
[HTTP METHOD] [Path]?[Query Parameters] HTTP/1.1
Host: [Host]
Authorization: Bearer [token]
Content-Type: application/json
[Additional Headers]
[Request body if applicable]Example - GET Collection with Filtering
GET /Employees?$filter=Status eq 'ACTIVE' and Department eq 'ENGINEERING'&$orderby=LastName asc&$top=50&$skip=0 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Accept: application/jsonExample - GET Single Resource
GET /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Accept: application/jsonExample - POST (Create)
POST /Employees HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
Prefer: return=representation
{
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2024-01-15",
"Salary": 95000.00
}Example - PATCH (Update)
PATCH /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
If-Match: "abc123def456"
{
"Department": "SALES",
"Salary": 105000.00
}Example - PUT (Replace)
PUT /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "SALES",
"HireDate": "2024-01-15",
"Salary": 105000.00
}Example - DELETE
DELETE /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...---
Response
Response Headers
| Header Name | Description | Possible Values |
|---|---|---|
| [Header] | [What this header contains] | [Example values] |
Example:
| Header Name | Description | Possible Values |
|---|---|---|
| Content-Type | Response body media type | application/json |
| Location | URL of created/modified resource | https://api.example.com/odata/v4/Employees('E12346') |
| ETag | Entity tag for caching and concurrency control | "abc123def456" |
| OData-Version | OData protocol version used | 4.0 |
| Preference-Applied | Which Prefer preference was applied | return=representation, return=minimal |Status Codes
| Status Code | Description | Conditions | Response Body |
|---|---|---|---|
| [Code] | [What status means] | [When this occurs] | [Type of response body] |
Example for GET (200 OK):
| Status Code | Description | Conditions | Response Body |
|---|---|---|---|
| 200 OK | Request successful | Entity/collection retrieved | Entity or collection data |
| 401 Unauthorized | Authentication required | Missing/invalid token | Error object |
| 403 Forbidden | Insufficient permissions | User lacks required role | Error object |
| 404 Not Found | Resource doesn't exist | Invalid ID/key | Error object |
| 500 Internal Server Error | Server error | Unhandled exception | Error object |Example for POST (201 Created):
| Status Code | Description | Conditions | Response Body |
|---|---|---|---|
| 201 Created | Resource created successfully | Valid request, auto-generated ID | Created entity (if Prefer: return=representation) |
| 400 Bad Request | Validation error | Invalid data, missing required field | Error object with details |
| 401 Unauthorized | Authentication required | Missing/invalid token | Error object |
| 403 Forbidden | Insufficient permissions | User lacks ROLE_HR_MANAGER | Error object |
| 409 Conflict | Duplicate/constraint violation | Email already exists | Error object with details |
| 500 Internal Server Error | Server error | Database error | Error object |Example for PATCH (204 No Content or 200 OK):
| Status Code | Description | Conditions | Response Body |
|---|---|---|---|
| 204 No Content | Update successful | Default response without Prefer header | Empty body |
| 200 OK | Update successful | Prefer: return=representation | Updated entity data |
| 400 Bad Request | Validation error | Invalid field values | Error object |
| 401 Unauthorized | Authentication required | Missing/invalid token | Error object |
| 403 Forbidden | Insufficient permissions | User lacks required role | Error object |
| 404 Not Found | Resource doesn't exist | Invalid ID | Error object |
| 412 Precondition Failed | Optimistic concurrency failure | If-Match ETag mismatch | Error object |
| 500 Internal Server Error | Server error | Database error | Error object |Response Body (Successful)
[Document the successful response body structure, including all properties.]
{
"[property]": "[value or type]",
"[property]": "[value or type]"
}Example for GET Single (200 OK):
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2020-06-01",
"Salary": 120000.00,
"Status": "ACTIVE",
"CreatedAt": "2020-06-01T09:00:00Z",
"LastModified": "2024-01-15T14:30:00Z"
}Example for GET Collection (200 OK):
{
"value": [
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Status": "ACTIVE"
},
{
"EmployeeID": "E12346",
"FirstName": "Jane",
"LastName": "Smith",
"Email": "jane.smith@company.com",
"Status": "ACTIVE"
}
]
}Example for POST (201 Created):
{
"EmployeeID": "E12346",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2024-01-15",
"Salary": 95000.00,
"Status": "ACTIVE",
"CreatedAt": "2024-01-15T10:30:00Z",
"LastModified": "2024-01-15T10:30:00Z"
}---
Complete Response Examples
Success Response (200 OK - GET)
HTTP/1.1 200 OK
Content-Type: application/json
ETag: "abc123def456"
OData-Version: 4.0
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2020-06-01",
"Salary": 120000.00,
"Status": "ACTIVE",
"CreatedAt": "2020-06-01T09:00:00Z",
"LastModified": "2024-01-15T14:30:00Z"
}Success Response (201 Created - POST)
HTTP/1.1 201 Created
Content-Type: application/json
Location: https://api.example.com/odata/v4/Employees('E12346')
ETag: "def789ghi123"
OData-Version: 4.0
{
"EmployeeID": "E12346",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2024-01-15",
"Salary": 95000.00,
"Status": "ACTIVE",
"CreatedAt": "2024-01-15T10:30:00Z",
"LastModified": "2024-01-15T10:30:00Z"
}Success Response (204 No Content - PATCH)
HTTP/1.1 204 No ContentSuccess Response (Collection - GET with $top/$skip)
HTTP/1.1 200 OK
Content-Type: application/json
OData-Version: 4.0
{
"value": [
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"Status": "ACTIVE"
},
{
"EmployeeID": "E12346",
"FirstName": "Jane",
"LastName": "Smith",
"Email": "jane.smith@company.com",
"Department": "SALES",
"Status": "ACTIVE"
}
]
}---
Error Response Examples
Error Response (400 Bad Request)
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed. See details for specific errors",
"details": [
{
"field": "Email",
"issue": "Email already exists in system",
"value": "john.doe@company.com",
"existingEmployeeId": "E10001"
},
{
"field": "Salary",
"issue": "Minimum salary must be at least 20000",
"value": "15000"
}
]
}
}Error Response (401 Unauthorized)
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": {
"code": "AUTHENTICATION_FAILED",
"message": "Authentication token missing, invalid, or expired",
"details": {
"reason": "Bearer token not provided in Authorization header"
}
}
}Error Response (403 Forbidden)
HTTP/1.1 403 Forbidden
Content-Type: application/json
{
"error": {
"code": "INSUFFICIENT_PERMISSION",
"message": "Insufficient permissions for this operation",
"details": {
"requiredRole": "ROLE_HR_MANAGER",
"userRole": "ROLE_HR_USER",
"operation": "Create Employee"
}
}
}Error Response (404 Not Found)
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"error": {
"code": "NOT_FOUND",
"message": "Requested resource not found",
"details": {
"resourceType": "Employee",
"providedId": "E99999",
"suggestion": "Verify the employee ID exists and hasn't been deleted"
}
}
}Error Response (409 Conflict - Duplicate)
HTTP/1.1 409 Conflict
Content-Type: application/json
{
"error": {
"code": "DUPLICATE_EMAIL",
"message": "Employee with provided email already exists",
"details": {
"email": "john.doe@company.com",
"existingEmployeeId": "E10001",
"existingEmployeeName": "John Doe"
}
}
}Error Response (500 Internal Server Error)
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Server encountered an unexpected error",
"details": {
"traceId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2024-01-15T14:30:00Z",
"suggestion": "Contact support with provided trace ID"
}
}
}---
Special Cases / Additional Notes
[Document any special behaviors, edge cases, or implementation notes]
Example:
- Soft delete: Employee records are marked with Status='TERMINATED', not physically deleted
- Automatic fields: EmployeeID, CreatedAt, and LastModified are auto-generated
- Optimistic concurrency: Use If-Match header with ETag to prevent lost updates
- Batch operations: This operation can be included in a $batch request
- Rate limiting: This operation counts as 1 request toward rate limit
---
Related Operations
---
Template Version: 1.0 Last Updated: 2025-11-21 Compliance: SAP API Style Guide Section 50
OData Resource Template
How to Use This Template
Purpose: Document individual OData resources (entity sets) within a service with all available operations.
When to Use:
- Creating detailed documentation for a specific OData entity set/resource
- Documenting all CRUD operations on a resource
- Listing navigation properties and custom functions/actions
- Linking from Service Overview to specific resource documentation
Instructions: 1. Replace all [bracketed text] with your actual resource information 2. Verify all operations against service metadata 3. Document navigation properties with cardinality (1:1, 1:N) 4. Include permission requirements for each operation type 5. List custom functions and actions with brief descriptions 6. Remove optional sections if not applicable
Cross-Reference: Use with OData Service Overview Template for service context and OData Operation Template for detailed operation docs.
Template Structure:
- Title & Introduction
- Resource Information (path, key, permissions)
- Operations (CRUD, navigation, custom)
- Common Headers
- Status and Error Codes
- Examples
---
[Resource Name] Resource
[Provide clear description of what this resource represents and contains. Include:
- What business entity or data domain it covers
- Primary use cases
- Relationship to other resources
- Scope or limitations]
Example: "Collection of all employees in the system. Provides access to employee master data including personal information, organizational assignments, employment status, and related compensation information. Navigation properties allow access to related departments, managers, and compensation details."
Additional Context
[Any important information about this resource]
This resource represents [explain domain/purpose]. Use for [primary use cases]. Navigation properties allow [explain relationships].
---
Resource Information
Resource Path
Path: [Relative path to entity set, e.g., /Employees]
[Explanation of resource path]
Absolute URI
Absolute URI: [Root URI]/[Resource Path]
Example: https://api.example.com/odata/v4/Employees
Key Property
Key Property: [Property name that uniquely identifies each resource]
[Description of key property and format/pattern]
Example:
Key Property: EmployeeID
Type: String
Format: E followed by 5 digits
Pattern: E[0-9]{5}
Example: E12345Individual Resource Addressing
[How to address/access a single resource by key]
URI Pattern: [Resource Path]\('{[Key Value]}')
Examples:
/Employees('E12345')- Address by string key/Employees(EmployeeID='E12345')- Explicit property namehttps://api.example.com/odata/v4/Employees('E12345')` - Absolute URI
Required Permissions
[Document permissions for different operation types on this resource]
| Operation Type | Required Permission | Description |
|---|---|---|
| Read/Query | [Role] | [What permission is needed and what it allows] |
| Create (POST) | [Role] | [Permission required] |
| Update (PUT/PATCH) | [Role] | [Permission required] |
| Delete | [Role] | [Permission required] |
Example:
| Operation Type | Required Permission | Description |
|---|---|---|
| Read/Query | ROLE_HR_USER | Read-only access to all employee data |
| Create (POST) | ROLE_HR_MANAGER | Create new employee records |
| Update (PUT/PATCH) | ROLE_HR_MANAGER | Modify existing employee data |
| Delete | ROLE_ADMIN | Delete employee records (limited to admins) |Resource Properties
[Complete list of all properties available on this resource]
| Property Name | Data Type | Description | Example | Notes |
|---|---|---|---|---|
| [Property] | [Type] | [Description] | [Example value] | [Nullable, constraints, etc.] |
Example:
| Property Name | Data Type | Description | Example | Notes |
|---|---|---|---|---|
| EmployeeID | String | Unique employee identifier | E12345 | Key property, not null |
| FirstName | String | Employee's first name | John | 1-50 characters, required |
| LastName | String | Employee's last name | Doe | 1-50 characters, required |
| Email | String | Corporate email address | john.doe@company.com | Must be unique, required |
| HireDate | Date | Employment start date | 2024-01-15 | ISO 8601 format, optional |
| Status | String | Employment status | ACTIVE | Values: ACTIVE, INACTIVE, ON_LEAVE, TERMINATED |
| Salary | Decimal | Annual salary | 95000.00 | Nullable, 2 decimal places |
| CreatedAt | DateTime | Record creation timestamp | 2024-01-15T10:30:00Z | UTC, auto-set |
| LastModified | DateTime | Last modification timestamp | 2024-01-15T14:30:00Z | UTC, auto-updated |---
Operations
CRUD Operations
Standard Create, Read, Update, Delete operations available on this resource:
| HTTP Method | Operation | URI | Description |
|---|---|---|---|
| GET | Read Collection | [Resource] | Retrieve all resources |
| GET | Read Single | [Resource]\('{Key}') | Retrieve specific resource |
| POST | Create | [Resource] | Create new resource |
| PUT | Replace | [Resource]\('{Key}') | Replace entire resource |
| PATCH | Update | [Resource]\('{Key}') | Partial update resource |
| DELETE | Delete | [Resource]\('{Key}') | Delete resource |
Example:
| HTTP Method | Operation | URI | Description |
|---|---|---|---|
| GET | [Query all employees](#operation-read-collection) | `/Employees` | Retrieve all employees with optional filtering and paging |
| GET | [Get single employee](#operation-read-single) | `/Employees\('{EmployeeID}')` | Retrieve specific employee by ID |
| POST | [Create employee](#operation-create) | `/Employees` | Create new employee record |
| PUT | [Replace employee](#operation-replace) | `/Employees\('{EmployeeID}')` | Replace entire employee record |
| PATCH | [Update employee](#operation-update) | `/Employees\('{EmployeeID}')` | Partial update of employee fields |
| DELETE | [Delete employee](#operation-delete) | `/Employees\('{EmployeeID}')` | Delete/deactivate employee |Navigation Properties
[If resource has relationships to other entities, document navigation properties]
Navigation Properties:
| Navigation Name | Target Entity | Cardinality | Description |
|---|---|---|---|
| [Property] | [Entity] | [1:1 / 1:N] | [Description of relationship] |
Example:
| Navigation Name | Target Entity | Cardinality | Description |
|---|---|---|---|
| Department | Department | 1:1 | Navigate to employee's department |
| Manager | Employee | 1:1 | Navigate to employee's manager (another employee) |
| DirectReports | Employee | 1:N | Navigate to employees reporting to this employee |
| Compensation | Compensation | 1:1 | Navigate to compensation details |How to Use Navigation Properties:
Using $expand to include related data:
GET /Employees?$expand=Department HTTP/1.1
Returns employee(s) with embedded Department entity data.Using $expand with $select to limit properties:
GET /Employees?$expand=Department($select=DepartmentID,Name) HTTP/1.1
Returns employee(s) with only specific Department properties included.Multi-level expansion:
GET /Employees?$expand=Department,Manager($expand=Department) HTTP/1.1
Includes Department for the employee and Department for the manager.
Maximum expansion depth: [specify limit, e.g., 3 levels]Custom Functions and Actions
[If resource supports custom functions or actions, document them]
| Operation Type | Name | URI | Description |
|---|---|---|---|
| [Function/Action] | [Name] | [URI Pattern] | [Description] |
Example:
| Operation Type | Name | URI | Description |
|---|---|---|---|
| Function | GetManager | `/Employees('{EmployeeID}')/GetManager()` | Get the direct manager of an employee |
| Function | GetDirectReports | `/Employees('{EmployeeID}')/GetDirectReports()` | Get all direct reports of an employee |
| Action | Promote | `/Employees('{EmployeeID}')/Promote` | Promote employee to next level (requires payload with details) |
| Action | Deactivate | `/Employees('{EmployeeID}')/Deactivate` | Mark employee as inactive |Detailed Function/Action Information:
For each custom operation, provide:
- Purpose and use case
- Request parameters (if any)
- Return type
- Permission requirements
- Example request/response
---
Common Headers
Request Headers
| Header Name | Required | Possible Values | Description |
|---|---|---|---|
| [Header] | [Yes/No] | [Values] | [Description with format/examples] |
Example:
| Header Name | Required | Possible Values | Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | OAuth2 authentication token in format: Authorization: Bearer {token} |
| Content-Type | Yes (POST/PUT/PATCH) | application/json | Media type of request body for create/update operations |
| Accept | No | application/json | Preferred response format. Default: application/json. Value: application/json |
| Prefer | No | return=representation, return=minimal | OData preference. return=representation: include created/updated resource. return=minimal: response without body. |
| If-Match | No | {ETag} | ETag value for optimistic concurrency control on PUT/PATCH. Example: "abc123def456". Prevents lost-update problem. |
| X-Request-ID | No | UUID | Request tracking ID for logging and debugging. Any valid UUID format. Optional but recommended. |Response Headers
| Header Name | Description | Example Value |
|---|---|---|
| [Header] | [What this header contains] | [Example] |
Example:
| Header Name | Description | Example Value |
|---|---|---|
| Content-Type | Response body media type | application/json |
| ETag | Entity tag for caching and optimistic concurrency | "abc123def456" |
| Location | URL of newly created resource (201 responses) | https://api.example.com/odata/v4/Employees('E12346') |
| OData-Version | OData protocol version | 4.0 |
| Preference-Applied | Which Prefer header preference was applied | return=representation |---
Status and Error Codes
Common Status Codes
| Status Code | Description | Typical Scenarios |
|---|---|---|
| [Code] | [Description] | [When this occurs] |
Example:
Success Codes:
| Status Code | Description | Typical Scenarios |
|---|---|---|
| 200 OK | Request successful. Response body contains requested data. | GET operations, POST with Prefer: return=representation |
| 201 Created | Resource successfully created. Location header contains new resource URL. | POST operations creating new entity |
| 204 No Content | Request successful. No response body returned. | DELETE operations, PUT/PATCH with Prefer: return=minimal |
Error Codes:
| Status Code | Description | Typical Scenarios |
|---|---|---|
| 400 Bad Request | Invalid request format, syntax, or OData query error. Response includes error details. | Malformed filter syntax, missing required fields, invalid data types |
| 401 Unauthorized | Authentication token missing, invalid, or expired. | Missing Authorization header, invalid token, expired token |
| 403 Forbidden | Authenticated but insufficient permissions for operation. | User lacks required role, permission denied for operation |
| 404 Not Found | Requested resource doesn't exist. | Invalid resource ID/key, deleted resource |
| 409 Conflict | Request conflicts with current state (duplicate, constraint violation). | Duplicate key/email, unique constraint violation, data conflict |
| 500 Internal Server Error | Server encountered unexpected error. | Unhandled server exception, database error |---
Examples
Query All Resources
Retrieve all resources with optional filtering, selection, ordering, and pagination:
Request:
GET /[ResourceName]?$filter=[filter]&$select=[properties]&$orderby=[property]&$top=[limit]&$skip=[offset] HTTP/1.1
Host: [host]
Authorization: Bearer {token}
Accept: application/jsonExample - Get all active employees, sorted by name, limit 20:
GET /Employees?$filter=Status eq 'ACTIVE'&$select=EmployeeID,FirstName,LastName,Email&$orderby=LastName asc&$top=20&$skip=0 HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Accept: application/jsonResponse (200 OK):
HTTP/1.1 200 OK
Content-Type: application/json
OData-Version: 4.0
{
"value": [
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com"
},
{
"EmployeeID": "E12346",
"FirstName": "Jane",
"LastName": "Smith",
"Email": "jane.smith@company.com"
}
]
}Query Single Resource
Retrieve a single resource by key:
Request:
GET /[ResourceName]('{Key}') HTTP/1.1
Host: [host]
Authorization: Bearer {token}
Accept: application/jsonExample:
GET /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Accept: application/jsonResponse (200 OK):
HTTP/1.1 200 OK
Content-Type: application/json
ETag: "abc123def456"
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": "ENGINEERING",
"HireDate": "2020-06-01",
"Salary": 120000.00,
"Status": "ACTIVE"
}Query with Navigation Expansion
Include related entity data:
Request:
GET /Employees('E12345')?$expand=Department,Manager($select=FirstName,LastName) HTTP/1.1
Host: api.example.com
Authorization: Bearer {token}
Accept: application/jsonResponse (200 OK):
HTTP/1.1 200 OK
Content-Type: application/json
{
"EmployeeID": "E12345",
"FirstName": "John",
"LastName": "Doe",
"Email": "john.doe@company.com",
"Department": {
"DepartmentID": "ENG",
"Name": "Engineering",
"Location": "San Francisco"
},
"Manager": {
"FirstName": "Jane",
"LastName": "Smith"
},
"Status": "ACTIVE"
}Create Resource
Create a new resource:
Request:
POST /[ResourceName] HTTP/1.1
Host: [host]
Authorization: Bearer {token}
Content-Type: application/json
Prefer: return=representation
[Request body with resource properties]Example:
POST /Employees HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
Prefer: return=representation
{
"FirstName": "Michael",
"LastName": "Johnson",
"Email": "michael.johnson@company.com",
"Department": "SALES",
"HireDate": "2024-01-15",
"Salary": 85000.00
}Response (201 Created):
HTTP/1.1 201 Created
Content-Type: application/json
Location: https://api.example.com/odata/v4/Employees('E12347')
{
"EmployeeID": "E12347",
"FirstName": "Michael",
"LastName": "Johnson",
"Email": "michael.johnson@company.com",
"Department": "SALES",
"HireDate": "2024-01-15",
"Salary": 85000.00,
"Status": "ACTIVE",
"CreatedAt": "2024-01-15T10:30:00Z"
}Update Resource
Partially update a resource using PATCH:
Request:
PATCH /[ResourceName]('{Key}') HTTP/1.1
Host: [host]
Authorization: Bearer {token}
Content-Type: application/json
If-Match: "{ETag}"
[Request body with properties to update]Example - Update salary and department:
PATCH /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
If-Match: "abc123def456"
{
"Department": "ENGINEERING",
"Salary": 125000.00
}Response (204 No Content):
HTTP/1.1 204 No ContentDelete Resource
Delete a resource:
Request:
DELETE /[ResourceName]('{Key}') HTTP/1.1
Host: [host]
Authorization: Bearer {token}Example:
DELETE /Employees('E12345') HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Response (204 No Content):
HTTP/1.1 204 No Content---
Related Documentation
- Parent Service: Service Name
- Detailed Operations:
- Create
- Read
- Update
- Delete
- Related Resources: Other Resource Name
---
Template Version: 1.0 Last Updated: 2025-11-21 Compliance: SAP API Style Guide Section 50
REST API Overview Template
How to Use This Template
Purpose: Document a set of related REST API methods that apply to the same resource or service.
When to Use:
- Creating documentation for a REST API with multiple methods on the same resource
- Need to document common properties shared by multiple endpoints
- Want to provide an organized reference for all methods on a resource
Instructions: 1. Replace all [bracketed text] with your actual content 2. Remove sections marked "Optional" if not applicable to your API 3. Provide complete examples with real data 4. Ensure all HTTP methods, URIs, and status codes are accurate 5. Test all documented features before publishing
Template Structure:
- Title & Introduction (~100 words)
- Base Information (URI, permissions, context)
- Methods Table (all HTTP methods for the resource)
- Common Request Headers
- Common Response Headers
- Status Codes
Token Tip: This overview prevents repetition in detailed method docs, saving ~40% of documentation tokens while improving clarity.
---
[Resource Name] REST API
[Provide a brief 2-3 sentence description of what this REST API does. Include:
- Main purpose of the API
- What resources or operations it manages
- Key capabilities (list, create, update, delete, etc.)
- Any special features or scope]
Example: "Provides methods to retrieve, create, update, and delete employee records. Supports querying employees by department, status, and other criteria. Fully supports pagination, filtering, and sorting."
Base Information
Base URI: [Absolute URI where API is hosted, e.g., https://api.example.com/v1/employees]
Permissions:
- [Read/Query operations]: [Required role, e.g., ROLE_HR_USER]
- [Write/Create operations]: [Required role, e.g., ROLE_HR_MANAGER]
- [Delete operations]: [Required role, e.g., ROLE_ADMIN]
Example:
- Read: ROLE_HR_USER (can list and view employees)
- Write: ROLE_HR_MANAGER (can create and modify employees)
- Delete: ROLE_ADMIN (can permanently delete employees)
Additional Notes:
- [Any important API usage notes, e.g., "All requests require Bearer token authentication"]
- [Pagination information, e.g., "API supports pagination with limit and offset parameters"]
- [Rate limiting info, e.g., "Rate limit: 1000 requests per hour"]
- [Special behaviors, e.g., "Soft deletes only - employee records are marked inactive, not removed"]
Methods
The following table lists all HTTP methods available for this resource:
| HTTP Method | Action | URI |
|---|---|---|
| [GET/POST/PUT/PATCH/DELETE] | Link to detailed method documentation | [Relative URI path] |
| [HTTP Method] | Link | [Path] |
Example:
| HTTP Method | Action | URI |
|---|---|---|
| GET | List All Employees | /employees |
| GET | Get Employee by ID | /employees/{employeeId} |
| POST | Create Employee | /employees |
| PUT | Update Employee (Full Replace) | /employees/{employeeId} |
| PATCH | Update Employee (Partial) | /employees/{employeeId} |
| DELETE | Delete Employee | /employees/{employeeId} |
Formatting Guidelines:
- Order methods by HTTP verb (GET, POST, PUT, PATCH, DELETE)
- Make "Action" column links to detailed method documentation
- Use consistent URI naming (e.g.,
{employeeId}for path parameters) - URI is relative to Base URI
Common Request Headers
The following headers are used in requests to this API:
| Header Name | Required | Description |
|---|---|---|
| [Header name] | [Yes/No] | [Description with possible values and format] |
Example:
| Header Name | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer token for authentication. Format: Authorization: Bearer {token}. Obtain token from authentication service. |
| Content-Type | Yes | Media type of request body. Value: application/json. Required for POST, PUT, PATCH requests. |
| Accept | No | Preferred response format. Value: application/json. Default if not specified: application/json. |
| X-Request-ID | No | Optional request ID for tracking and debugging. Format: UUID (e.g., 123e4567-e89b-12d3-a456-426614174000). Any valid UUID accepted. |
| If-Match | No | ETag for optimistic locking on PUT/PATCH requests. Format: quoted string (e.g., "abc123def456"). Required when implementing concurrent update protection. |
Field Descriptions:
- Header Name: Exact header name (case-sensitive)
- Required: Yes if must be present; No if optional
- Description: Purpose, accepted values, format, constraints, and default values
Common Response Headers
The following headers appear in responses from this API:
| Header Name | Description |
|---|---|
| [Header name] | [Purpose and possible values] |
Example:
| Header Name | Description |
|---|---|
| Content-Type | Type of response body. Always application/json. |
| X-Total-Count | Total number of available resources (included in paginated responses). Example: 5000 |
| X-RateLimit-Limit | Maximum API calls allowed in rate limit window. Example: 1000 |
| X-RateLimit-Remaining | Number of API calls remaining in current window. Example: 998 |
| X-RateLimit-Reset | Timestamp when rate limit resets (Unix seconds). Example: 1642123456 |
| Location | URL of newly created resource (included in 201 Created responses). Format: Absolute URL. Example: https://api.example.com/v1/employees/E12346 |
| ETag | Entity tag for caching and optimistic locking. Format: Quoted string. Example: "abc123def456" |
Status Codes
All HTTP status codes that can be returned by methods in this API are documented below:
Success Codes:
| Status Code | Result Description |
|---|---|
| 200 OK | Request successful. Response body contains requested data. |
| 201 Created | Resource successfully created. Location header contains URL to new resource. Response body typically contains created object. |
| 204 No Content | Request successful. No response body returned. Typically for DELETE operations or updates with Prefer: return=minimal. |
Error Codes:
| Status Code | Result Description |
|---|---|
| 400 Bad Request | Invalid request format, syntax, or validation failure. Response body contains error details. Check request format, required fields, and parameter values. |
| 401 Unauthorized | Authentication required or authentication token invalid/expired. Obtain new token or verify Bearer token format. |
| 403 Forbidden | Authenticated but insufficient permissions for operation. Request ROLE_[appropriate role] permission assignment. |
| 404 Not Found | Requested resource doesn't exist. Verify resource ID/URI and that resource hasn't been deleted. |
| 409 Conflict | Request conflicts with current resource state (e.g., duplicate email, unique constraint violation). Resource may already exist or data constraint prevents operation. |
| 410 Gone | Resource previously existed but is now deleted. Resource cannot be recovered. |
| 429 Too Many Requests | Rate limit exceeded. See X-RateLimit-Reset header for when to retry. Implement exponential backoff. |
| 500 Internal Server Error | Server encountered unexpected error. Contact support if issue persists. |
| 503 Service Unavailable | Service temporarily unavailable (maintenance, overload). Retry after delay. See Retry-After header if present. |
Common Error Response Body Structure:
{
"error": {
"code": "[Error code identifier]",
"message": "[Human-readable error message]",
"details": {
"[field or property]": "[specific error detail]"
}
}
}---
Additional Information
Rate Limiting
[Document rate limiting policy if applicable]
- Limit: [requests per time period, e.g., 1000 requests per hour]
- Tracking: [Rate limit headers used for tracking]
- Handling: [What happens when limit exceeded and how to recover]
Pagination
[Document pagination approach if applicable]
- Query Parameters: [e.g., limit and offset]
- Default Size: [default number of results]
- Maximum Size: [maximum allowed per request]
- Response Structure: [how pagination info appears in response]
Filtering and Sorting
[Document if API supports query-based filtering/sorting]
- Filtering Syntax: [explain parameter format]
- Sortable Fields: [list fields that support sorting]
- Example: [provide sample filter/sort query]
Error Handling Best Practices
- Always check status code before processing response body
- Implement exponential backoff for retryable errors (5xx, 429)
- Parse error response for details about what went wrong
- Log error codes and messages for debugging
- Distinguish between client errors (4xx) and server errors (5xx)
---
Related Documentation
- API Style Guide - Manual REST and OData Documentation
- OAuth 2.0 Authentication
- HTTP Status Codes Reference (RFC 9110)
Template Version: 1.0 Last Updated: 2025-11-21 Compliance: SAP API Style Guide Section 50