Working with JSON Schema Metadata

Similarly to OpenAPI 3.0 metadata, you can obtain the JSON Schema description by setting the value of the Accept HTTP header to application: schema+json, as in the following example.

          SET-HEADER Accept: application/schema+json
GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/metadata-catalog/customer 

        

The following is a shortened example of a response to the previous request. Note that the metadata provided in JSON Schema format only describes the internal structure of a resource, for example, its fields, sublists, or subrecords, and links to related resources, and does not describe URLs, HTTP methods, and parameters.

          {
    "type": "object",
    "properties": {
        "custentity_integer": {
            "title": "Integer Number",
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "x-ns-custom-field": true
        },
        "startDate": {
            "title": "Start Date",
            "type": "string",
            "description": "<p>Enter the date this person or company became a customer, lead or prospect.</p><p>If this person or company has a contract with you, enter the start date of the contract.</p><p>If you enter an estimate or an opportunity for this customer, this field will be updated with the date of that transaction.</p>",
            "format": "date",
            "nullable": true
        },            
         }
   },

    "$schema": "https://json-schema.org/draft-06/hyper-schema#" 

        
Note:

The JSON generated by the REST API generates external URL links leading to metadata about the linked record types. These are, however, reachable only locally and are unreachable for external validators (such as the JSON Schema validator).

The JSON Schema record metadata received in the previous step can be used as input for any JSON Schema Draft 6 compatible library and tool for further processing. The most frequent use of the JSON Schema record metadata is input and output validation. The following JSON object is an example representing a customer record.

          {
    entityid: "My Customer",
    currency: { "id": "1" },
    representingsubsidiary: { "id": "1" },
    monthlyclosing: "31 - End of the Month"
} 

        

You can check if this record representation conforms to the record metadata schema by using the freely available JSON Schema Validator.

The JSON Schema Validator

Related Topics

Working with Resource Metadata
Getting Metadata
Working with OpenAPI 3.0 Metadata

General Notices