MENU
      메서드 추가

        메서드 추가


        기사 요약

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

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

        요청

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

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

        요청 헤더

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

        요청 경로 파라미터

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

        필드타입필수 여부설명
        product-idStringRequiredAPI가 속한 Product ID
        api-idStringRequired메서드를 추가할 API의 ID
        resource-idStringRequiredAPI 내 대상 리소스의 ID

        요청 구문

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

        {
          "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"
          }
        }
        JSON

        요청 바디

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

        필드타입필수 여부설명
        methodNameStringRequired메서드 타입
        • ANY | GET | POST | PUT | DELETE | PATCH | OPTIONS | HEAD
        methodDescriptionStringOptional메서드에 대한 설명
        • 0~300자
        mockEndPointStringConditionalAPI Gateway에서 설정한 값을 반환하는 엔드포인트 타입
        • mockEndPoint, ncpEndPoint, httpEndPoint 중 하나를 선택
        mockEndPoint.httpStatusIntegerConditional응답 상태 코드
        • mockEndPoint 타입 선택 시 필수 입력
        • HTTP의 Response Status Code에 상응하는 값
        mockEndPoint.responseStringOptional응답에 표시할 데이터
        • 0~1500자
        mockEndPoint.headersMap<String, String>Optional응답에 포함할 헤더
        • 헤더 Key, Value 형태
        ncpEndPointStringConditional네이버 클라우드 플랫폼의 서비스를 이용해 값을 반환하는 엔드포인트 타입
        • mockEndPoint, ncpEndPoint, httpEndPoint 중 하나를 선택
        ncpEndPoint.serviceStringConditional응답 반환에 사용할 네이버 클라우드 플랫폼의 서비스
        • Cloud Functions 서비스 이용 가능
        • ncpEndPoint 타입 선택 시 필수 입력
        ncpEndPoint.regionStringConditionalCloud Functions 서비스의 지원 리전 코드
        • KR | JPN | SGN
        • ncpEndPoint 타입 선택 시 필수 입력
        ncpEndPoint.actionIdStringConditionalCloud Functions 서비스의 액션 ID
        • ncpEndPoint 타입 선택 시 필수 입력
        ncpEndPoint.actionNameStringConditionalCloud Functions 서비스의 액션 이름
        • ncpEndPoint 타입 선택 시 필수 입력
        ncpEndPoint.streamBooleanConditionalStream 기능 사용 여부
        • true | false
          • true: Stream 기능 사용
          • false: Stream 기능 사용 안 함
        • ncpEndPoint 타입 선택 시 필수 입력
        ncpEndPoint.methodStringOptionalCloud Functions 서비스로 요청할 메서드 타입
        • ANY | GET | POST | PUT | DELETE | PATCH | OPTIONS | HEAD
        ncpEndPoint.urlStringConditionalCloud Functions 서비스의 URL 경로
        • ncpEndPoint 타입 선택 시 필수 입력
        httpEndPointStringConditionalHTTP(S) 엔드포인트의 호출 결과를 반환하는 엔드포인트 타입
        • mockEndPoint, ncpEndPoint, httpEndPoint 중 하나를 선택
        httpEndPoint.methodStringConditional백엔드 서버로 요청할 메서드 타입
        • ANY | GET | POST | PUT | DELETE | PATCH | OPTIONS | HEAD
        • httpEndPoint 타입 선택 시 필수 입력
        httpEndPoint.streamBooleanConditionalStream 기능 사용 여부
        • true | false
          • true: Stream 기능 사용. 파일 업로드 성격의 요청인 경우 사용. 응답 시간은 5분, 요청 크기는 최대 100 MB로 제한.
          • false: Stream 기능 사용 안 함. 응답 시간은 30초, 요청 크기는 최대 10 MB로 제한.
        • httpEndPoint 타입 선택 시 필수 입력
        httpEndPoint.urlStringConditional백엔드 서버로 요청할 URL 경로
        • 도메인 제외
        • 리소스 경로 변수 및 요청 파라미터에서 정의한 쿼리 스트링과 헤더 사용 가능. 사용 시 '{}'를 사용해 정의.
        • 1~1500자
        • httpEndPoint 타입 선택 시 필수 입력
        requiredApiKeyStringRequiredAPI key 사용 정보
        requiredApiKey.requiredBooleanRequiredAPI key 사용 여부
        • true | false
          • true: API key 사용
          • false: API key 사용 안 함. Product 구독 방식과 Usage Plan의 적용을 받지 않음.
        validationStringRequired유효성 검사 정보
        validation.typeStringRequired유효성 검사 범위
        • NONE | QUERYSTRING_HEADERS
          • NONE: 유효성 검사 미실행
          • QUERYSTRING_HEADERS: 쿼리 스트링과 헤더에 대한 유효성 검사 실행
        validation.headersList<String>Conditional유효성 검사 대상인 필수 헤더 리스트
        • QUERYSTRING_HEADERS 선택 시 입력
        validation.queryStringsList<String>Conditional유효성 검사 대상인 필수 쿼리 스트링 리스트
        • QUERYSTRING_HEADERS 선택 시 입력
        authenticationStringRequired인증 정보
        authentication.platformStringRequired인증 방법 설정
        • NONE | IAM | IAM_AUTHORIZATION | AUTHORIZER
          • NONE: 인증 미사용
          • IAM: 네이버 클라우드 플랫폼에서 제공하는 IAM 인증 사용
          • IAM_AUTHORIZATION: 네이버 클라우드 플랫폼에서 제공하는 IAM 인증/인가 사용
          • AUTHORIZER: 미리 생성한 Authorizer 사용
        authentication.authorizerIdStringConditional인증 방법으로 Authorizer 이용 시 사용할 Authorizer의 ID

        요청 예시

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

        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"
        }'
        Curl

        응답

        응답 형식을 설명합니다.

        응답 구문

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

        {
          "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"
            }
          } ]
        }
        JSON

        응답 상태 코드

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

        응답 예시

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

        {
          "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"
            }
          ]
        }
        JSON

        이 문서가 도움이 되었습니까?

        Changing your password will log you out immediately. Use the new password to log back in.
        First name must have atleast 2 characters. Numbers and special characters are not allowed.
        Last name must have atleast 1 characters. Numbers and special characters are not allowed.
        Enter a valid email
        Enter a valid password
        Your profile has been successfully updated.