DataMaker REST API

Namespaces

GET http://server/api/namespaces

Returns a list of registered namespaces.

SchemaDef

GET http://server/api/schemadef?namespace=(namespace)&schemaname=(schemaname)

Returns the specified schema definition.

Arguments:

POST http://server/api/schemadef

Adds the defined schema to the store.

Arguments:

SchemaDefs

GET http://server/api/schemadefs?namespace=(namespace)

Returns all the schema definitions within the namespace.

Arguments:

GetRandomExample

GET http://server/api/schemadef/getrandomexample?namespace=(namespace)&schemaname=(schemaname)&count=(number)

Returns the specified number of random examples based on the specified schema definition.

Arguments:

DataMaker Json Schema

SchemaDef

{
"Namespace":"namespace",
"SchemaName":"schemaname",
"RootSchemaObject": (schema object)
}

Example

The following schema definition creates a schema named "exampleschema" in the "examplenamespace" namespace with a single static value object equal to "example value".

{
"Namespace":"examplenamespace",
"SchemaName":"exampleschema",
"RootSchemaObject":
{
"ObjectTypeName":"StaticSchemaObject",
"StaticValue": "example value"
}
}

ChoiceSchemaObject

{
"ObjectTypeName":"ChoiceSchemaObject",
"ChoiceArray": [value1, value2]
}

The ChoiceSchemaObject represents a set of values of which only one is selected. The values in the ChoiceArray may be a mix of strings and other schema objects.

Example

The following creates a choice schema object whose posible values are "option1" and a static schema object whose value is "option2".

{
"ObjectTypeName":"ChoiceSchemaObject",
"ChoiceArray": ["option1", {"ObjectTypeName":"StaticSchemaObject", "StaticValue":"option2"}],
}

OptionalSchemaObject

{
"ObjectTypeName":"OptionalSchemaObject",
"OptionalValue": (value) }

The OptionalSchemaObject represents value that is allowed by not required. The optional value field can either be a string value, or another schema object. Self-references to the containing schema definition below an OptionalSchemaObject are not considered an infinite loop with the exception of descendent objects that reference external schema definitions with infinite loops of their own.

Example

The following creates a optional schema object whose value is "I don't have to be here but I am.".

{
"ObjectTypeName":"OptionalSchemaObject",
"OptionalValue": "I don't have to be here but I am.",
}

RangeAlphaSchemaObject

{
"ObjectTypeName":"RangeAlphaSchemaObject",
"MinAlpha": number,
"MaxAlpha": number
}

The RangeAlphaSchemaObject represents an character value between MinAlpha and MaxAlpha inclusive. Both MinAlpha and MaxAlpha are required, both must be single characters and MaxAlpha must be larger than or equal to MinAlpha. Order is regular ASCII character order.

Example

The following creates a range alpha schema object whose value is between m and q.

{
"ObjectTypeName":"RangeAlphaSchemaObject",
"MinAlpha": "m",
"MaxAlpha": "q"
}

RangeNumericSchemaObject

{
"ObjectTypeName":"RangeNumericSchemaObject",
"MinNumeric": number,
"MaxNumeric": number
}

The RangeNumericSchemaObject represents an integer value between MinNumeric and MaxNumeric inclusive. Both MinNumeric and MaxNumeric are required and MaxNumeric must be larger than or equal to MinNumeric.

Example

The following creates a range numeric schema object whose value is between 15 and 75.

{
"ObjectTypeName":"RangeNumericSchemaObject",
"MinNumeric": 15,
"MaxNumeric": 75
}

ReferenceSchemaObject

{
"ObjectTypeName":"ReferenceSchemaObject",
"Namespace": "namespace",
"SchemaName": "schemaname"
}

The ReferenceSchemaObject indicates a schema definition based on the Namespace and SchemaName fields. The schema definition must have been defined before creation of this schema definition, or must be a reference to itself. Self-references are used for recursive schema build. Infinite loops are caused by any reference back to a prior used schema definition which does not have some escape mechanism via optional or choice based schema objects.

Example

The following creates a reference schema object that indicates a schema named "exampleschema" in the namespace "examplenamespace".

{
"ObjectTypeName":"ReferenceSchemaObject",
"Namespace": "examplenamespace",
"SchemaName":"exampleschema"
}

SequenceSchemaObject

{
"ObjectTypeName":"SequenceSchemaObject",
"SequenceArray": [(value1), (value2)]
}

The field SequenceArray can be a mixed array of string values and other schema objects. All items in the SequenceArray are treated as required objects in the schema, presented in order.

Example

The following creates a sequence schema object with a sequence consisting of a string and a StaticSchemaObject.

{
"ObjectTypeName":"SequenceSchemaObject",
"SequenceArray": ["value1", {"ObjectTypeName":"StaticSchemaObject", "StaticValue":"example value"}]
}

StaticSchemaObject

{
"ObjectTypeName":"StaticSchemaObject",
"StaticValue": (string)
}

Example

The following creates a schema object whose value is equal to "example value".

{
"ObjectTypeName":"StaticSchemaObject",
"StaticValue": "example value"
}