메서드 수정

Prev Next

Classic/VPC 환경에서 이용 가능합니다.

사용자 정의한 메서드의 설정을 변경합니다.

요청

요청 형식을 설명합니다. 요청 형식은 다음과 같습니다.

메서드 URI
PATCH /products/{product-id}/apis/{api-id}/resources/{resource-id}/methods/{method-name}

요청 헤더

API Gateway에서 공통으로 사용하는 헤더에 대한 자세한 내용은 API Gateway 요청 헤더를 참조해 주십시오.

요청 경로 파라미터

파라미터에 대한 설명은 다음과 같습니다.

필드 타입 필수 여부 설명
product-id String Required API가 속한 Product ID
api-id String Required 수정할 API의 ID
resource-id String Required API 내 대상 리소스의 ID
method-name String Required 대상 메서드 타입
  • ANY | GET | POST | PUT | DELETE | PATCH | OPTIONS | HEAD

요청 구문

요청 구문은 다음과 같습니다.

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

요청 바디

요청 바디에 대한 설명은 다음과 같습니다.

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

요청 예시

요청 예시는 다음과 같습니다.

curl --location --request PATCH 'https://apigateway.apigw.gov-ntruss.com/api/v1/products/********o9/apis/cvcohvd2xj/resources/p1hiuvmwv3/methods/OPTIONS' \
--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 '{
  "mockEndPoint": {
    "httpStatus": 400,
    "response": "user error"
  },
    "authentication": {
    "platform": "NONE"
  },
  "requiredApiKey": {
    "required": true
  },
  "validation": {
    "type": "NONE"
  }
}'

응답

응답 형식을 설명합니다.

응답 구문

응답 구문은 다음과 같습니다.

{
  "method" : {
    "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"
    }
  }
}

응답 상태 코드

API Gateway에서 공통으로 사용하는 응답 상태 코드에 대한 자세한 내용은 API Gateway 응답 상태 코드를 참조해 주십시오.

응답 예시

응답 예시는 다음과 같습니다.

{
  "method": {
    "apiId": "cvcohvd2xj",
    "resourceId": "p1hiuvmwv3",
    "methodName": "GET",
    "useBodyWhenFormData": false,
    "validation": {
      "type": "NONE"
    },
    "authentication": {
      "platform": "NONE"
    },
    "requiredApiKey": {
      "required": true
    },
    "mockEndPoint": {
      "httpStatus": 400,
      "response": "user error"
    },
    "tenantId": "********65ec41039ce6668c2058b8a9",
    "modifier": "********-7fcd-11ec-a6ba-246e9659184c"
  }
}