Apigee를 사용하면 코드를 작성하지 않고 정책을 사용하여 API 동작을 프로그래밍할 수 있습니다. 정책은 특정적으로 제한된 관리 기능을 구현하는 모듈과 같습니다.
정책을 사용하면 API에 일반적인 관리 기능을 쉽게 안정적으로 추가할 수 있습니다. 정책은 보안, 비율 제한, 변환, 미디에이션과 같은 기능을 제공하므로 이러한 기능을 직접 코딩하고 유지할 필요가 없습니다.
Apigee에서 제공하는 정책 유형 집합 이외에도 다양하게 사용할 수 있습니다. 또한 커스텀 스크립트와 코드(예: 자바스크립트 애플리케이션)를 작성하여 API 프록시 기능을 확장하고 Apigee 정책에서 지원하는 기본 관리 기능을 기반으로 혁신할 수 있습니다.
이 주제에서는 Apigee의 정책 유형과 사용을 간략하게 설명합니다. 특정 정책에 대한 자세한 내용은 정책 참조 개요를 참조하세요.
정책 유형 및 카테고리
기술적으로 정책은 XML 형식의 구성 파일입니다. 각 정책 구조(예: 필수 구성 요소와 선택적 구성 요소)는 XML 스키마에서 정의됩니다. XML 도구에 능숙하다면 GitHub에서 API 플랫폼 샘플의 정책 스키마를 숙지하는 것이 좋습니다.
Apigee 정책은 다음과 같은 기능 카테고리로 분류됩니다. 각 정책 카테고리에 사용할 수 있는 정책은 정책 참조 개요에 나와 있습니다.
트래픽 관리
트래픽 관리 카테고리의 정책을 사용하면 API 프록시를 통해 요청 및 응답 메시지의 흐름을 제어할 수 있습니다. 이러한 정책은 운영 수준의 제어와 비즈니스 수준의 제어를 모두 지원합니다. 이를 통해 원시 처리량을 제어할 수 있으며 앱별로 트래픽을 제어할 수도 있습니다. 트래픽 관리 정책 유형을 사용하면 할당량을 적용할 수 있으며 서비스 거부 공격을 완화하는데도 도움이 됩니다.
보안
보안 카테고리의 정책은 인증, 승인은 물론 콘텐츠 기반 보안을 지원합니다.
미디에이션
미디에이션 카테고리의 정책을 사용하면 API 프록시를 통과하는 메시지를 직접 조작할 수 있습니다. 메시지 형식을 XML에서 JSON으로(또는 그 반대로) 변환하거나 하나의 XML 형식을 다른 XML 형식으로 변환할 수 있습니다. 또한 메시지를 파싱하고 새 메시지를 생성하며, 전송 메시지의 값을 변경할 수 있습니다. 또한 미디에이션 정책은 Apigee에서 노출하는 기본 서비스와 상호작용하여 런타임에 앱, 개발자, 보안 토큰, API 제품에 대한 데이터를 검색할 수 있도록 합니다.
확장
확장 카테고리의 정책을 사용하면 Apigee의 확장성을 활용하여 원하는 프로그래밍 언어로 커스텀 동작을 구현할 수 있습니다.
정책 변경사항을 적용하려면 API 프록시 버전을 환경에 배포해야 합니다.
정책을 연결하거나 기존 정책을 변경한 후 Apigee UI 또는 Apigee API를 사용하여 변경사항을 배포합니다.
정책 시행 확인
정책이 올바르게 적용되었는지 확인하려면 HTTP 클라이언트가 API를 호출해야 합니다. Quota 구성을 확인하려면 할당량(예: 분당 요청 1회)을 설정한 후 할당량 정책에서 설정한 할당량 한도를 초과하는 API에 여러 요청을 제출합니다. ProxyEndpoint의 기본 경로 설정으로 구성된 URI 경로는 아래 요청에서 /weather입니다.
위의 오류 메시지의 형식을 확인합니다. faultstring 속성과 errorcode 속성이 포함되어 있습니다. 대부분의 경우 이러한 오류를 처리하려면 몇 가지 동작을 구현해야 합니다. 예를 들어 앱이 Quota를 초과한 개발자에게 맞춤설정된 메시지를 보낼 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[[["\u003cp\u003eApigee utilizes policies, which are pre-built modules, to enable API behavior management without direct coding, offering features like security, rate-limiting, transformation, and mediation.\u003c/p\u003e\n"],["\u003cp\u003ePolicies in Apigee are XML-formatted configuration files, grouped into categories like Traffic Management, Security, Mediation, and Extension, each with distinct functions.\u003c/p\u003e\n"],["\u003cp\u003eTo apply a policy to an API proxy, it must be attached to a flow within the proxy, and subsequent policy modifications require deploying the API proxy revision to an environment to take effect.\u003c/p\u003e\n"],["\u003cp\u003eApigee policies can enforce conditions, such as quotas, and generate error messages that include a \u003ccode\u003efaultstring\u003c/code\u003e and an \u003ccode\u003eerrorcode\u003c/code\u003e, allowing for customized fault handling and responses.\u003c/p\u003e\n"],["\u003cp\u003eCommon policy sets in Apigee often include basic API key validation and transformations, with examples provided for both request and response flows, involving policies such as \u003ccode\u003eSpikeArrest\u003c/code\u003e, \u003ccode\u003eQuota\u003c/code\u003e, and \u003ccode\u003eResponseCache\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# What's a policy?\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nApigee enables you to *program* API behavior without writing any code, by using\n*policies*. A policy is like a module that implements a specific, limited management function.\nPolicies are designed to let you add common types of management capabilities to an API easily and\nreliably. Policies provide features like security, rate-limiting, transformation, and mediation\ncapabilities, saving you from having to code and maintain this functionality on your own.\n\nYou're not limited to the set of policy types provided by Apigee. You can also write\ncustom scripts and code (such as JavaScript applications), that extend API proxy\nfunctionality and enable you to innovate on top of the basic management capabilities supported by\nApigee policies.\n\nThis topic provides an overview of policy types and use in Apigee. For information on specific\npolicies, see the\n[Policies reference overview](/apigee/docs/api-platform/reference/policies/reference-overview-policy).\n\nPolicy types and categories\n---------------------------\n\nTechnically, a policy is an XML-formatted configuration file. Each policy's structure\n(for example, the required and optional configuration elements) is defined by an\n[XML schema](https://en.wikipedia.org/wiki/XML_schema). If you are proficient with XML tools,\nit is worthwhile to familiarize yourself with the policy schemas in the\n[API Platform samples](https://github.com/apigee/api-platform-samples/)\non GitHub.\n\nApigee policies are grouped into the following functional categories. The policies\navailable for each policy category are listed in the\n[Policy reference overview](/apigee/docs/api-platform/reference/policies/reference-overview-policy).\n\n### Traffic management\n\nPolicies in the traffic management category enable you to control the flow of request and\nresponse messages through an API proxy. These policies support both operational- and\nbusiness-level control. They give you control over raw throughput, and can also control traffic\non a per-app basis. Traffic management policy types enable you to enforce quotas, and they also\nhelp you to mitigate denial of service attacks.\n\n### Security\n\nPolicies in the security category support authentication, authorization, as well as\ncontent-based security.\n\n### Mediation\n\nPolicies in the mediation category enable you to actively manipulate messages as they flow\nthrough API proxies. They enable you to transform message formats, from XML to JSON (and\nvice-versa), or to transform one XML format to another XML format. They also enable you to\nparse messages, to generate new messages and to change values on outbound messages. Mediation\npolicies also interact with basic services exposed by Apigee, enabling you to retrieve data\nabout apps, developers, security tokens, and API products at runtime.\n\n### Extension\n\nPolicies in the extension category enable you to tap into the extensibility of Apigee to\nimplement custom behavior in the programming language of you choice.\n\nAttaching policies\n------------------\n\nIn order for a policy to apply to your API proxy, you must attach it to the proxy in a flow.\nFor information, see the other topics in this section, including\n[Attaching and configuring policies in the UI](/apigee/docs/api-platform/develop/attaching-and-configuring-policies-management-ui#new-proxy-editor)\nand\n[Attaching and configuring policies in XML files](/apigee/docs/api-platform/develop/attaching-and-configuring-policies-xml-files).\n\nDeploying policy changes\n------------------------\n\nFor policy changes to take effect, you must deploy the API proxy revision to an environment.\nAfter you attach a policy or make changes to an existing policy, use the Apigee UI or the\nApigee API to [deploy the changes](/apigee/docs/api-platform/deploy/ui-deploy-overview).\n\nVerifying policy enforcement\n----------------------------\n\nTo verify that a policy is enforced properly, the API must be invoked by an HTTP client. To\nverify a `Quota` configuration, set a quota (for example, at one request per minute),\nthen submit multiple requests to the API exceeding the quota limit\nthat you set in the quota policy. (The URI path, configured as the base path setting in the\nProxyEndpoint, in the request below is `/weather`). \n\n```scdoc\nhttp://ORG_NAME-test.apigee.net/weather/forecastrss?w=12797282\n```\n\nAfter you submit more than one request within a minute, you should see the following error\nmessage: \n\n```text\n{\n \"fault\":{\n \"faultstring\":\"policies.ratelimit.QuotaViolation\",\n \"detail\":{\n \"errorcode\":\"policies.ratelimit.QuotaViolation\"\n }\n }\n}\n```\n\nThis indicates that the `Quota` policy is being enforced by Apigee.\n\nPolicy-based fault handling\n---------------------------\n\nNote the format of the error message above. It contains a `faultstring` property\nand an `errorcode` property. In many cases, you need to implement some behavior to\nhandle these errors. For example, you may wish to issue a customized message to a developer whose\napp has exceeded the `Quota`.\n\nFor more on fault handling, see [Handling faults](/apigee/docs/api-platform/fundamentals/fault-handling).\n\nBest practices: Common policy sets\n----------------------------------\n\nTo meet basic management requirements, API proxies usually enforce the following policies:\n\n### Basic API key\nvalidation\n\n**ProxyEndpoint Request Flow:**\n\n1. `SpikeArrest`\n2. `XMLThreatProtection` or `JSONThreatProtection`\n3. API key validation\n4. `Quota`\n5. `ResponseCache`\n\n**ProxyEndpoint Response Flow:**\n\n1. `ResponseCache`\n\n### Basic transformation: JSON to\nXML\n\n**Request Flow:**\n\n1. `SpikeArrest`\n2. `JSONThreatProtection`\n3. API key validation\n4. `Quota`\n5. JSONToXML\n\n**Response Flow:**\n\n1. `XMLToJSON`\n2. `ResponseCache`"]]