Skip to content

Load a sample set

POST
/api/v1/samples
curl --request POST \
--url http://localhost:11044/api/v1/samples \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "edges": [ { "from": "example", "properties": { "additionalProperty": "example" }, "to": "example", "type": "example" } ], "matched": 1, "name": "example", "nodes": [ { "displayName": "example", "id": "example", "label": "example", "properties": { "additionalProperty": "example" } } ], "realm": "example", "truncated": true }'

Nodes are marked :_Sample and tagged with the set name, so the set can be removed later without touching anything real. Loading the same set twice merges rather than duplicates.

The sample set to write. name (required) tags every node so the set can be removed by it; realm (required, non-blank) is not checked against what is installed; nodes (at least one) each carry a plain-identifier label, an id unique within the set, an optional displayName and properties with no leading-underscore keys; edges join nodes by from/type/to id, with at least one end in this set, and carry their own properties under the same key rule. Nodes are merged on label, id and the user’s scope, so a second load does not duplicate. matched and truncated from an export are accepted and ignored. Any problem refuses the whole set with 400 before anything is written

Media typeapplication/json

Body of POST /samples: a named set of fictional records for one realm. Its nodes are marked :_Sample and tagged with the set’s name, so the set can be removed without touching real records. POST /samples/export answers this same shape.

object
edges
required

Relationships to create, each with at least one end among this set’s nodes; empty when omitted

Array<object>

One relationship of a sample set, between nodes named by id

object
from
required

Id of the start node: one of the set’s nodes, or an existing node in this world. Nothing is created when no node has it

string
properties
required

The relationship’s own property values, by key; a key starting with _ is refused. Exported with the edge and written back by a load, so a set carries what its joins say, not only that they exist; a shape-only export keeps the keys and blanks the values as it does a node’s

object
key
additional properties
to
required

Id of the end node: one of the set’s nodes, or an existing node in this world. Nothing is created when no node has it

string
type
required

Relationship type: a letter, then up to 63 letters, digits or underscores

string
matched

Accepted so an export loads back as written, and ignored

integer format: int32
name
required

Name of the set, tagged on every node it loads; DELETE /samples/{name} removes it. Must not be blank

string
nodes
required

The records to load, at least one; ids must be unique within the set

Array<object>

One node of a sample set, as loaded by POST /samples and returned by POST /samples/export

object
displayName

Name the node is shown by; null leaves any name it already has. Null in a shape-only export

string
id
required

Identity of the node within its label in this world; loading merges on it, so loading a set again updates rather than duplicates. Edges name nodes by it. A shape-only export replaces it with n1, n2, …

string
label
required

The node’s label: a letter, then up to 63 letters, digits or underscores

string
properties
required

Further property values set on the node, by key; a key starting with _ is refused. A shape-only export keeps the keys and blanks the values: text becomes …, numbers 0, lists item by item, booleans are kept

object
key
additional properties
realm
required

Name of the realm whose types the set populates. Must not be blank

string
truncated

Accepted so an export loads back as written, and ignored

boolean

Example generated

{
"edges": [
{
"from": "example",
"properties": {
"additionalProperty": "example"
},
"to": "example",
"type": "example"
}
],
"matched": 1,
"name": "example",
"nodes": [
{
"displayName": "example",
"id": "example",
"label": "example",
"properties": {
"additionalProperty": "example"
}
}
],
"realm": "example",
"truncated": true
}

Loaded

Media type*/*

What a sample-data load did, or why it refused. The same shape either way: a refusal is this with ok false and the reasons in problems

object
edges
required

How many edges were written. Zero on a refusal

integer format: int32
nodes
required

How many nodes were written. Zero on a refusal

integer format: int32
ok
required

Whether the set was loaded. False means nothing was written and problems says why

boolean
problems
required

Why the load was refused, one sentence per problem. Empty when ok is true

Array<string>

The set was refused; the body lists why

Media type*/*

What a sample-data load did, or why it refused. The same shape either way: a refusal is this with ok false and the reasons in problems

object
edges
required

How many edges were written. Zero on a refusal

integer format: int32
nodes
required

How many nodes were written. Zero on a refusal

integer format: int32
ok
required

Whether the set was loaded. False means nothing was written and problems says why

boolean
problems
required

Why the load was refused, one sentence per problem. Empty when ok is true

Array<string>