/topologies/{topologyName}/links

The /topologies/{topologyName}/links endpoint allows you to create, retrieve and delete one or more links in a topology. You cannot update links, you must delete and re-add them.

To retrieve and delete all links for a node see /topologies/{topologyName}/links/{nodeName}.

Back to Topologies API Endpoint Reference.

GET

Retrieves details of all links for a specified topology.

Path parameters

The GET request takes the following path parameter:

Name

Type

Required

Description

 topologyName

String

Yes

Name of the topology. You can obtain all topology names by executing a GET request to /topologies.

Response

The GET request returns the following response:

Successful requests return an array of JSON objects containing the following:

Name

Type

Description

description

String

Description of the link between the nodes.

sourceNode

String

Name of the source node. Note that topology links in Moogsoft Enterprise are bidirectional.

sinkNode

String

Name of the sink node. Note that topology links in Moogsoft Enterprise are bidirectional.

Example

The following example demonstrates making a GET request to the /topologies/{topologyName}/links endpoint.

Request example

Example cURL GET request to return link details for the "host" topology:

curl -X GET 'https://example.com/api/v1/topologies/host/links' -u phil:password123

Response example

Example response returning the topology's link details:

[
    {
        "description: "link1",
        "sourceNode": "node1",
        "sinkNode: "node2"
    },
    {
        "description: "link2",
        "sourceNode": "node2",
        "sinkNode: "node3"
    }
]

POST

Creates one or more links in a topology. Creates the specified source nodes and sink nodes if they do not already exist.

Request arguments

The POST request takes the following request payload:

Name

Type

Required

Description

sourceNode

String

Yes

Name of the source node. Note that topology links in Moogsoft Enterprise are bidirectional.

sinkNode

String

Yes

Name of the sink node. Note that topology links in Moogsoft Enterprise are bidirectional.

description

String

No

Description of the link between the nodes.

Response

The POST request returns the following response:

Successful requests return an array of JSON objects containing the following:

Name

Type

Description

sourceNode

String

Name of the source node. Note that topology links in Moogsoft Enterprise are bidirectional.

sinkNode

String

Name of the sink node. Note that topology links in Moogsoft Enterprise are bidirectional.

description

String

Description of the link between the nodes.

If the supplied link already exists, the HTTP code 200 is returned.

Example

The following example demonstrates making a POST request to the /topologies/{topologyName}/links endpoint.

Request example

Example cURL POST request to create two links in the "host" topology:

curl -X POST 'https://example.com/api/v1/topologies/host/links' \
--header 'Content-Type: application/json; charset=UTF-8' \
-u phil:password123 \
-d '[{"sourceNode":"node1","sinkNode":"node2","description":"link1"},{"sourceNode":"node2","sinkNode":"node3","description":"link2"}]'

Response example

Example response returning the new links:

[
    {
        "description: "link1",
        "sourceNode": "node1",
        "sinkNode:" "node2"
    },
    {
        "description: "link2",
        "sourceNode": "node2",
        "sinkNode:" "node3"
    }
]

DELETE

Deletes one or more links in a topology.

Request arguments

The DELETE request takes the following request payload:

Name

Type

Required

Description

names

Array

Yes

One or more links in the format:

[
    {
        "sourceNode" : "node1",
        "sinkNode" : "node2"
    },
    {
        "sourceNode" : "node2",
        "sinkNode" : "node3"
    }
]

Response

The DELETE request returns the following response:

If the request contains some existing and some non-existing links, the existing links will be deleted and non-existing links will be returned in the response.

Example

The following example demonstrates making a DELETE request to the /topologies/{topologyName}/links endpoint.

Request example

Example cURL request to delete the "link1" and "link2" links in the "host" topology:

curl -X DELETE 'https://example.com/api/v1/topologies/host/links' \
-H 'Content-Type: application/json' \
-d ["link1","link2"] \
-u phil:password123

Response example

An example response where link1 and link2 do not exist:

{
"message": "Some of the links could not be deleted as they did not exist","invalidLinks": 
    [
        {
            "sourceNode": "node1",
            "sinkNode": "node2"
        }
    ]
}