인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
디자인 및 창작 · SKILL.md

sap-api-policy

sap-api-policy

SAP API Management policy design and governance — security, traffic, mediation, lifecycle

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: sap-api-policy description: SAP API Management policy design and governance — security, traffic, mediation, lifecycle trigger: keywords: [api policy, api management, api proxy, rate limiting, api security, api key, api business hub, openapi spec sap, api gateway, api lifecycle] intent: Designing and managing API policies on SAP BTP API Management / Integration Suite prerequisites:

  • SAP BTP API Management or Integration Suite entitlement
  • API Portal access (https://.apim.cfapps..hana.ondemand.com)
  • Postman or curl for testing
  • Backend API endpoint (SAP Gateway, CAP, or external)

SAP API Policy — API Management & Governance

1. Architecture

Client → API Gateway (SAP API Management)
         ├─ Security: OAuth2, API Key, Basic Auth
         ├─ Traffic: Rate Limit, Spike Arrest, Caching
         ├─ Mediation: JSON↔XML, XSLT, URL Rewrite
         └─ Monitoring: Analytics, Alerts

2. Security Policies

<!-- OAuth2: validate XSUAA token -->
<OAuthV2 async="false" continueOnError="false" enabled="true">
    <ExternalAuthorization>false</ExternalAuthorization>
    <Operation>VerifyAccessToken</Operation>
    <SupportedGrantTypes>
        <GrantType>client_credentials</GrantType>
    </SupportedGrantTypes>
</OAuthV2>

<!-- JSON Threat Protection -->
<JSONThreatProtection>
    <ArrayElementCount>100</ArrayElementCount>
    <ContainerDepth>10</ContainerDepth>
    <StringValueLength>50000</StringValueLength>
</JSONThreatProtection>

3. Traffic Management

<!-- Spike Arrest: 100 req/s -->
<SpikeArrest><Rate>100ps</Rate>
    <Identifier ref="request.header.X-Forwarded-For"/></SpikeArrest>

<!-- Monthly Quota: 10K requests -->
<Quota type="calendar"><Allow count="10000"/>
    <Interval>1</Interval><TimeUnit>month</TimeUnit>
    <Distributed>true</Distributed></Quota>

4. Mediation & URL Rewrite

<!-- Rewrite OData path + inject client -->
<AssignMessage>
    <Set><Path>/sap/opu/odata/sap/ZMATERIAL_SRV/</Path>
        <QueryParams><QueryParam name="sap-client">100</QueryParam></QueryParams>
    </Set>
</AssignMessage>

5. API Lifecycle

PhaseActivity
DesignOpenAPI spec → review in API Business Hub
DevelopImplement backend (CAP/ABAP)
SecureApply OAuth2 + threat + rate limit policies
PublishDeploy proxy → expose endpoint
MonitorAnalytics dashboard
DeprecateSunset old versions → redirect
RetireRemove proxy

6. Policy Execution Order

ProxyEndpoint PreFlow → TargetEndpoint PreFlow → backend →
TargetEndpoint PostFlow → ProxyEndpoint PostFlow

Pitfalls

  • Policy not applying → Cause: wrong flow step. Solution: verify policy is attached to correct flow (PreFlow vs PostFlow) in API Portal.
  • OData $metadata timeout → Cause: un-cached metadata response. Solution: add ResponseCache to proxy PreFlow, TTL=600s.
  • CSRF token missing → Cause: OData writes need token. Solution: GET x-csrf-token: Fetch first, then POST/PUT with x-csrf-token: <token>.
  • Rate limit not enforced → Cause: quota not distributed. Solution: set <Distributed>true</Distributed> on Quota policy.
  • SAML vs OAuth confusion → Solution: use OAuth2 (XSUAA) for BTP apps, SAML bearer for SAP Gateway on-premise.

Verification

# Test proxy health
curl -s -o /dev/null -w "%{http_code}" https://<proxy>.apim.cfapps.<region>.hana.ondemand.com/health
# Expect: 200

# Check OAuth is working
curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $TOKEN" \
  https://<proxy>/sap/opu/odata/sap/ZMATERIAL_SRV/MaterialSet?\$top=1
# Expect: 200

# Check rate limit headers
curl -sI -H "Authorization: Bearer $TOKEN" https://<proxy>/api/v1/test \
  | grep -i x-ratelimit
저장한 Skills