Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
{
	"modelSchema": {
		"properties": {
			"<property-name>": {
				"type": "<property-type>",
				...item1 properties....
			},
			"<property-name>": {
				 ... 
			}
		}
	},
	"displayProperty": "<property-name>",
	"uniquenssRuless": "<property-name1> [, <property-name2>, .....]"
}

Descriptions of the Domain Version Properties

...

propertyrequiredvalid valuesdescription
modelSchemayesSee Domains and Domains below.A JSON model describing the schema for the data domain; it defines the properties that make up the domains schema. The root node of the model schema is the properties element. See Domains and Domains below.
displayPropertyyesA valid model schema property nameA property defined in the modelSchema that acts as an index for the domain. The data values for the displayProperty must always be unique. See Domains below.
uniquenessRulesnoOne or more valid model schema property namesRequired data and their associated rules that are cache'd to make sure duplicate data entries are not POSTed to the domain. This defaults to the displayProperty if it is not provided. See Domains below.

The Default Domain Version

The first version of a domain is the default version and will remain the default version if more versions of a given domain are created.The PATCH method for the /domains/<domain-uuid> endpoint can be used to change a domain's default version. See the YOUnite API for implementation details.

Creating a Domain is Three-Step Process

...

  1. POST the Domain 

    For example, to create a simple states domain :

    POST /domains

    Code Block
    languagejs
    {
    	"name": "states",
    	"zoneUuid": "a1aca070-846f-44e5-9471-c73b46c35f4a",
    	"domainType": "MASTER_CENTRALIZED"
     }

    The location header returned provides the URI for POSTing a domain version below.

    e.g.

    Location /domains/7f28180b-7d9f-42b5-b5ed-d4a0e7ec09fc

  2. POST a Domain Version

    POST /domains/versions/7f28180b-7d9f-42b5-b5ed-d4a0e7ec09fc

  3. POST Master Data Records to the Domain

    Once the domain/version has been created, master data can be POSTed to it using the /mdr endpoint:

    POST /mdrs

    Code Block
    languagejs
    {
    	"name": "states",
    	"version": 1,
    	"json": {
    		"name" : "California", 
    		"abbreviation" : "CA"
    	}
     }


Retrieving Master Data

...

The MDRs for a the default version of a domain can be retrieved with the following:

POST /mdrs?filters=name:<domain-name>

Retrieving the MDRs for a given domain and version:

POST /mdrs?filters=name:<domain-name>,version:<version>

The Display Property

Each domain must have a display property (displayProperty). The display property acts as a primary key for the domain. For example, the states domain above uses the abbreviation property as the display property, Use the /mdrs endpoint and the appropriate domain and display property to GET an MDR:

GET /mdrs/states/?filters=name:states,displayProperty:CA

If there are multiple versions of a domain, and a domain other than the default is needed, the version number can be included in the URI. For example, assume there are three versions of the states domain and the current version is version 3. The consumer can retrieve the California version 1 MDR by using the following:

GET /mdrs/states:1/CA 

In addition to the display property, requests for an MDR can be made using the UUID. For example, assume, the UUID for the state MDR for California is ad8570ae-2172-4179-e9276a03bf2d. To retrieve the MDR using the UUID:

GET /mdrs/states/data/ad8570ae-2172-4179-927e-e9276a03bf2d

...

?filters=name:states,version:1,displayProperty:CA

Display Property Rules

  • The value provided for the displayProperty must be unique between all domain entries of a given domain type (e.g. each entry in the state domain must have a unique stateName).
  • Only one property in a domain can be the displayProperty. If more than one property is required to ensure uniqueness see the Domains below.
  • Display properties are limited to type STRING.
  • Properties designated as the displayProperty are required; i.e. null values are not allowed.
  • Display properties are case sensitive e.g. "California" is NOT equal to "california".

...

  • If both required and default are used to define a given property, then default is ignored and POSTing data must include the required property.

POST a Domain Version

Following is a simple example of model for a domain version.  

POST /domains/versions/2a556060-e694-4b61-a3bb-67beda37da13

Code Block
languagetext
{
	"name": "countries",
	"displayProperty": "countrycode",
	"modelSchema" {
		"properties": {
			"name": {
				"type": "string",
				"min": 2,
				"max": 80,
				"required": true
			},
			"countrycode": {
				"type": "string",
				"min": 3,
				"max": 3,
				"required": true
			},
			"population": {
				"type": "int",
				"required": false
			},
			"capital": {
				"city": {
					"type": "string",
					"required": true
				},
				"districtOrState": {
					"type": "string",
					"required": true
				}
			}
		}
	}
}

Note that inside the value portion of the modelSchema node, all of the double quotes must be escaped with a backslash (\). Newlines have been added above for readability but they should not be included in the request body. The request should look like this:

Code Block
languagetext
{
    "name": "countries179",
    "displayProperty": "countrycode"
	"modelSchema": "{ \"properties\": { \"name\": { \"type\": \"string\", \"min\": 2, \"max\": 80, \"required\": true }, \"countrycode\": { \"type\": \"string\", \"min\": 3, \"max\": 3, \"required\": true }, \"population\": { \"type\": \"int\", \"required\": false }, \"capital\": { \"city\": { \"type\": \"string\", \"required\": true }, \"districtOrState\": { \"type\": \"string\", \"required\": true } } } }",
    "name": "countries179"
}

...