Skip to main content

mr relation create

Create a new Relation linking two Groups with a typed relationship. --from-group-id, --to-group-id, and --relation-type-id are all required. The referenced relation-type's FromCategory and ToCategory must match the categories of the two groups; otherwise the server rejects the request. --name and --description are optional labels stored on the relation itself. Sends POST /v1/relation and returns the persisted record.

Usage

mr relation create

Examples

Create a relation linking group 3 to group 4 with relation-type 2

mr relation create --from-group-id 3 --to-group-id 4 --relation-type-id 2

Create a named relation with a description

mr relation create --from-group-id 3 --to-group-id 4 --relation-type-id 2 \
--name "directed-by" --description "Kubrick directed 2001"

Flags

FlagTypeDefaultDescription
--from-group-iduint0Source group ID (required) (required)
--to-group-iduint0Target group ID (required) (required)
--relation-type-iduint0Relation type ID (required) (required)
--namestring``Relation name
--descriptionstring``Relation description

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

Relation object with ID, Name, Description, FromGroupId, ToGroupId, RelationTypeId, CreatedAt/UpdatedAt

Exit Codes

0 on success; 1 on any error

See Also