MENU
      Schema 검증

        Schema 검증


        기사 요약

        Domain 생성을 하기 전에 Schema 검증을 할 수 있습니다. 해당 요청을 통해 올바르게 작성된 Schema 인지 확인이 가능합니다.
        색인(index)은 추가는 가능하지만, 생성 후 삭제는 불가능합니다.

        POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
        HTTP

        요청

        요청 바디

        필드명필수 여부타입제약 사항설명
        documentYesSchema검색 설정

        응답

        응답 Status

        HTTP StatusDesc
        200OK(유효한 Schema)
        400Bad Request(유효하지 않은 Schema)
        401Unauthorized
        403Forbidden
        404Not Found
        500Internal Server Error

        예시

        요청 예시 - 유효한 Schema

        POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
        
        POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
        Host:cloudsearch.apigw.ntruss.com
        Content-Type: application/json
        
        x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
        x-ncp-apigw-timestamp: 1545817618751
        x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
        
        {
          "document": {
            "primarySectionName": "name",
            "sections": [
              {
                "docProperties": [
                  {
                    "type": "string",
                    "name": "dp_name"
                  }
                ],
                "name": "name"
              },
              {
                "docProperties": [
                  {
                    "type": "string",
                    "name": "dp_phone_number"
                  }
                ],
                "name": "phone_number"
              }
            ],
            "indexes": [
              {
                "documentTermWeight": "sum_wgt",
                "buildInfos": [
                  {
                    "sections": [
                      "name"
                    ],
                    "sectionTermWeight": "1.0 * stw_2p(tf, 0.5, 0.25, 0., length / 128.0)",
                    "indexProcessors": [
                      {
                        "type": "hanaterm",
                        "method": "sgmt",
                        "option": "+korea +josacat +eomicat"
                      }
                    ],
                    "name": "index_build_0"
                  }
                ],
                "name": "name"
              }
            ]
          }
        }
        HTTP

        응답 예시 - 유효한 Schema

        {
          "status": "valid",
          "message": "OK",
          "response": "{\"status\":{\"code\":0,\"message\":\"ok\"}}\n"
        }
        JSON

        요청 예시 - 유효하지 않은 Schema : JSON Parsing 오류

        POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
        
        POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
        Host:cloudsearch.apigw.ntruss.com
        accept:application/json
        
        x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
        x-ncp-apigw-timestamp: 1545817618751
        x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
        
        {
          "document": {
        
            "sections": [
              {
                "docProperties": [
                  {
                    "type": "string",
                    "name": "dp_name"
                  }
                ],
                "name": "name"
              }
            ]
        
        }
        HTTP

        응답 예시 - 유효하지 않은 Schema : JSON Parsing 오류

        {
          "expose": true,
          "statusCode": 400,
          "status": 400,
          "body": "{\n  \"document\": {\n   \n    \"sections\": [\n      {\n        \"docProperties\": [\n          {\n            \"type\": \"string\",\n            \"name\": \"dp_name\"\n          }\n        ],\n        \"name\": \"name\"\n      }\n    ]\n\n}",
          "type": "entity.parse.failed"
        }
        JSON

        요청 예시 - 유효하지 않은 Schema : 필수 필드 누락

        POST https://cloudsearch.apigw.ntruss.com/CloudSearch/real/v1/schemaValidator
        
        POST /CloudSearch/real/v1/schemaValidator HTTP/1.1
        Host:cloudsearch.apigw.ntruss.com
        accept:application/json
        
        x-ncp-apigw-signature-v2: cDwtHuQeGmwWyNmwlN6XIGA66zge4iMXvfoDQNna05g=
        x-ncp-apigw-timestamp: 1545817618751
        x-ncp-iam-access-key: teGTwtcSEGA7fu28BGGi
        
        {
          "document": {
        
            "sections": [
              {
                "docProperties": [
                  {
                    "type": "string",
                    "name": "dp_name"
                  }
                ],
                "name": "name"
              }
            ]
          }
        }
        HTTP

        응답 - 유효하지 않은 Schema : 필수 필드 누락

        {
          "0": {
            "keyword": "required",
            "dataPath": ".document",
            "schemaPath": "#/required",
            "params": {
              "missingProperty": "primarySectionName"
            },
            "message": "should have required property 'primarySectionName'"
          },
          "1": {
            "keyword": "required",
            "dataPath": ".document",
            "schemaPath": "#/required",
            "params": {
              "missingProperty": "indexes"
            },
            "message": "should have required property 'indexes'"
          },
          "message": "Bad Request"
        }
        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.