---
title: "메서드 추가"
slug: "apigateway-postmethods"
tags: ["API Gateway", "Method"]
updated: 2026-04-23T08:55:57Z
published: 2026-04-23T09:02:24Z
canonical: "api.ncloud-docs.com/apigateway-postmethods"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 메서드 추가

<p class="platform-info type-classic-vpc">Classic/VPC 환경에서 이용 가능합니다.</p>

생성한 API 리소스에 메서드를 설정하여 추가합니다.

## 요청<a name="요청"></a>
요청 형식을 설명합니다. 요청 형식은 다음과 같습니다.
| 메서드 | URI |
| :--- | :--- |
| POST | /api/v1/products/{product-id}/apis/{api-id}/resources/{resource-id}/methods |

### 요청 헤더<a name="요청헤더"></a>
API Gateway에서 공통으로 사용하는 헤더에 대한 정보는 [API Gateway 요청 헤더](/docs/ai-application-service-apigateway#요청헤더)를 참조해 주십시오.

                 
### 요청 경로 파라미터<a name="요청경로파라미터"></a>
요청 경로 파라미터에 대한 설명은 다음과 같습니다.

| 필드 | 타입 | 필수 여부 | 설명 |
| :--- | :--- | :--- | :--- |
| `product-id` | String | Required | API가 속한 Product ID<ul><li>1~10자</li><li>[Product 목록 조회](/docs/apigateway-product-getproductlist) 참조</li></ul> |
| `api-id` | String | Required | 메서드를 추가할 API의 ID<ul><li>1~10자</li><li>[API 조회](/docs/apigateway-api-apis) 참조</li></ul> |
| `resource-id` | String | Required | API 내 대상 리소스의 ID<ul><li>1~10자</li><li>[Resource 목록 조회](/docs/apigateway-resource-getresourcelist) 참조</li></ul> |


### 요청 구문<a name="요청구문"></a>
요청 구문은 다음과 같습니다. 

```json
{
  "methodName" : "ANY",
  "methodDescription" : "methodDescription",
  "mockEndPoint" : {
    "httpStatus" : 0,
    "response" : "response",
    "headers" : {
      "key" : "value"
    }
  },
  "ncpEndPoint" : {
    "service" : "service",
    "region" : "KR",
    "actionId" : "actionId",
    "actionName" : "actionName",
    "stream" : true,
    "method" : "ANY",
    "url" : "url"
  },
  "httpEndPoint" : {
    "method" : "ANY",
    "stream" : true,
    "url" : "url"
  },
  "requiredApiKey" : {
    "required" : true
  },
  "validation" : {
    "type" : "NONE",
    "headers" : [ "headers" ],
    "queryStrings" : [ "queryStrings" ]
  },
  "authentication" : {
    "platform" : "NONE",
    "authorizerId" : "authorizerId"
  }
}
```

### 요청 바디<a name="요청바디"></a>
요청 바디에 대한 설명은 다음과 같습니다.

| 필드 | 타입 | 필수 여부 | 설명 |
| :--- | :--- | :--- | :--- |
| `methodName` | String | Required | 메서드 타입<ul><li>`ANY` \| `GET` \| `POST` \| `PUT` \| `DELETE` \| `PATCH` \| `OPTIONS` \| `HEAD`</li></ul> |
| `methodDescription` | String | Optional | 메서드에 대한 설명<ul><li>0~2000자</li></ul> |
| `mockEndPoint` | String | Conditional | API Gateway에서 설정한 값을 반환하는 엔드포인트 타입<ul><li>`mockEndPoint`, `ncpEndPoint`, `httpEndPoint` 중 하나를 선택</li></ul> |
| `mockEndPoint.httpStatus` | Integer | Conditional | 응답 상태 코드<ul><li>`mockEndPoint` 타입 선택 시 필수 입력</li><li>HTTP의 Response Status Code에 상응하는 값</li></ul> |
| `mockEndPoint.response` | String | Optional | 응답에 표시할 데이터<ul><li>0~1500자</li></ul> |
| `mockEndPoint.headers` | Map[String, String] | Optional | 응답에 포함할 헤더<ul><li>헤더 Key, Value 형태</li></ul> |
| `ncpEndPoint` | String | Conditional | 네이버 클라우드 플랫폼의 서비스를 이용해 값을 반환하는 엔드포인트 타입<ul><li>`mockEndPoint`, `ncpEndPoint`, `httpEndPoint` 중 하나를 선택</li></ul> |
| `ncpEndPoint.service` | String | Conditional | 응답 반환에 사용할 네이버 클라우드 플랫폼의 서비스<ul><li>Cloud Functions 서비스 이용 가능</li><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `ncpEndPoint.region` | String | Conditional | Cloud Functions 서비스의 지원 리전 코드<ul><li>`KR` \| `JPN` \| `SGN`</li><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `ncpEndPoint.actionId` | String | Conditional | Cloud Functions 서비스의 액션 ID<ul><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `ncpEndPoint.actionName` | String | Conditional | Cloud Functions 서비스의 액션 이름<ul><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `ncpEndPoint.stream` | Boolean | Conditional | Stream 기능 사용 여부<ul><li>`true` \| `false`<ul><li>`true`: Stream 기능 사용</li><li>`false`: Stream 기능 사용 안 함</li></ul></li><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `ncpEndPoint.method` | String | Optional | Cloud Functions 서비스로 요청할 메서드 타입<ul><li>`ANY` \| `GET` \| `POST` \| `PUT` \| `DELETE` \| `PATCH` \| `OPTIONS` \| `HEAD`</li></ul> |
| `ncpEndPoint.url` | String | Conditional | Cloud Functions 서비스의 URL 경로<ul><li>`ncpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `httpEndPoint` | String | Conditional | HTTP(S) 엔드포인트의 호출 결과를 반환하는 엔드포인트 타입<ul><li>`mockEndPoint`, `ncpEndPoint`, `httpEndPoint` 중 하나를 선택</li></ul> |
| `httpEndPoint.method` | String | Conditional | 백엔드 서버로 요청할 메서드 타입<ul><li>`ANY` \| `GET` \| `POST` \| `PUT` \| `DELETE` \| `PATCH` \| `OPTIONS` \| `HEAD`</li><li>`httpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `httpEndPoint.stream` | Boolean | Conditional | Stream 기능 사용 여부<ul><li>`true` \| `false`<ul><li>`true`: Stream 기능 사용. 파일 업로드 성격의 요청인 경우 사용. 응답 시간은 5분, 요청 크기는 최대 100 MB로 제한.</li><li>`false`: Stream 기능 사용 안 함. 응답 시간은 30초, 요청 크기는 최대 10 MB로 제한.</li></ul></li><li>`httpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `httpEndPoint.url` | String | Conditional | 백엔드 서버로 요청할 URL 경로<ul><li>도메인 제외</li><li>리소스 경로 변수 및 요청 파라미터에서 정의한 쿼리 스트링과 헤더 사용 가능. 사용 시 '{}'를 사용해 정의.</li><li>1~1500자</li><li>`httpEndPoint` 타입 선택 시 필수 입력</li></ul> |
| `requiredApiKey` | String | Required | API key 사용 정보 |
| `requiredApiKey.required` | Boolean | Required | API key 사용 여부<ul><li>`true` \| `false`<ul><li>`true`: API key 사용</li><li>`false`: API key 사용 안 함. Product 구독 방식과 Usage Plan의 적용을 받지 않음.</li></ul></li></ul> |
| `validation` | String | Required | 유효성 검사 정보 |
| `validation.type` | String | Required | 유효성 검사 범위<ul><li>`NONE` \| `QUERYSTRING_HEADERS`<ul><li>`NONE`: 유효성 검사 미실행</li><li>`QUERYSTRING_HEADERS`: 쿼리 스트링과 헤더에 대한 유효성 검사 실행</li></ul></li></ul> |
| `validation.headers` | List[String] | Conditional | 유효성 검사 대상인 필수 헤더 리스트<ul><li>`QUERYSTRING_HEADERS` 선택 시 입력</li></ul> |
| `validation.queryStrings` | List[String] | Conditional | 유효성 검사 대상인 필수 쿼리 스트링 리스트<ul><li>`QUERYSTRING_HEADERS` 선택 시 입력</li></ul> |
| `authentication` | String | Required | 인증 정보 |
| `authentication.platform` | String | Required | 인증 방법 설정<ul><li>`NONE` \| `IAM` \| `IAM_AUTHORIZATION` \| `AUTHORIZER`<ul><li>`NONE`: 인증 미사용</li><li>`IAM`: 네이버 클라우드 플랫폼에서 제공하는 IAM 인증 사용</li><li>`IAM_AUTHORIZATION`: 네이버 클라우드 플랫폼에서 제공하는 IAM 인증/인가 사용</li><li>`AUTHORIZER`: 미리 생성한 Authorizer 사용</li></ul></li></ul> |
| `authentication.authorizerId` | String | Conditional | 인증 방법으로 Authorizer 이용 시 사용할 Authorizer의 ID |


### 요청 예시<a name="요청예시"></a>
요청 예시는 다음과 같습니다. 

```shell
curl --location --request POST 'https://apigateway.apigw.ntruss.com/api/v1/products/********o9/apis/cvcohvd2xj/resources/p1hiuvmwv3/methods' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data '{
  "methodName": "GET",
  "httpEndPoint": {
    "stream": true,
    "method": "ANY",
    "url": "/sample22"
  },
  "validation": {
    "type": "NONE",
    "queryStrings": [
      "string"
    ],
    "headers": [
      "string"
    ]
  },
  "authentication": {
    "platform": "NONE"
  },
  "requiredApiKey": {
    "required": true
  },
  "methodDescription": "string"
}'
```

## 응답<a name="응답"></a>
응답 형식을 설명합니다.
    
### 응답 구문<a name="응답구문"></a>
응답 구문은 다음과 같습니다.

```json
{
  "methods" : [ {
    "methodDescription" : "methodDescription",
    "resourceId" : "resourceId",
    "useBodyWhenFormData" : true,
    "modifier" : "modifier",
    "resourcePath" : "resourcePath",
    "methodName" : "ANY",
    "ncpEndPoint" : {
      "method" : "ANY",
      "stream" : true,
      "service" : "service",
      "actionId" : "actionId",
      "region" : "KR",
      "url" : "url",
      "actionName" : "actionName"
    },
    "requiredApiKey" : {
      "required" : true
    },
    "mockEndPoint" : {
      "headers" : {
        "key" : "headers"
      },
      "response" : "response",
      "httpStatus" : 0
    },
    "produces" : "produces",
    "tenantId" : "tenantId",
    "consumers" : "consumers",
    "apiId" : "apiId",
    "validation" : {
      "headers" : [ "headers" ],
      "queryStrings" : [ "queryStrings" ],
      "type" : "NONE"
    },
    "authentication" : {
      "authorizerId" : "authorizerId",
      "platform" : "NONE"
    },
    "httpEndPoint" : {
      "method" : "ANY",
      "stream" : true,
      "url" : "url"
    }
  } ]
}
```

### 응답 상태 코드 <a name="응답상태코드"></a>
API Gateway에서 공통으로 사용하는 응답 상태 코드에 대한 정보는 [API Gateway 응답 상태 코드](/docs/ai-application-service-apigateway#응답상태코드)를 참조해 주십시오.

### 응답 예시<a name="응답예시"></a>
응답 예시는 다음과 같습니다. 
```json
{
  "methods": [
    {
      "apiId": "cvcohvd2xj",
      "resourceId": "p1hiuvmwv3",
      "methodDescription": "string",
      "methodName": "GET",
      "useBodyWhenFormData": false,
      "validation": {
        "type": "NONE",
        "queryStrings": [
          "string"
        ],
        "headers": [
          "string"
        ]
      },
      "authentication": {
        "platform": "NONE"
      },
      "requiredApiKey": {
        "required": true
      },
      "httpEndPoint": {
        "stream": true,
        "method": "GET",
        "url": "/sample22"
      },
      "tenantId": "********65ec41039ce6668c2058b8a9",
      "modifier": "********-7fcd-11ec-a6ba-246e9659184c"
    }
  ]
}
```
