Validate schema

Prev Next

We are preparing a localization service for the content. We will do our best to provide the localization service as soon as possible.

Before creating domain, you can check your schema. This operation validates whether a schema is valid.

An index can be added, but cannot be deleted.

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

Request

Request Body

Field Required Type Limitations Description
document Y Schema Search settings

Response

Response status

HTTP status Description
200 OK (Valid schema)
400 Bad Request (Invalid schema)
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Examples

Request Example - Valid 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": {
    "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"
      }
    ]
  }
}

Request Example - Valid schema

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

Request Example - Invalid schema: JSON parsing error

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

}

Request Example - Invalid schema: JSON parsing error

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

Request Example - Invalid schema: Required field is missing

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

Request Example - Invalid schema: Required field is missing

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