Diagram API

From TeamServer ER/Studio
Jump to: navigation, search

Go Up to API Reference

This part of the Team Server API allows you to work with diagrams.

GET v1/diagrams

Obtains a list of diagrams.

If successful, the response from the server provides a list of diagrams with details about each one of them.

GET v1/diagrams/<id>

Obtains information about the diagram with the specified ID.

Diagram Fields

Diagram resources in Diagram API requests and responses can include any combination of the following fields:

Item Example Description

"id"

2

An integer that uniquely identifies the diagram.

"name"

"Adventure Works.DM1"

The name of the diagram.

"filename"

"Adventure Works.DM1"

The name of the file where the diagram is stored.

"version"

"1.1"

The current version of the diagram.

"author"

"Product Management"

The author of the diagram.

"company"

"My Company"

The company that owns the diagram.

"url"

"/v1/diagrams/2"

Path relative to the Team Server root API URL that points to the entry of the diagram resource.

For example, if the Team Server root API URL is http://teamserver.example.com/api , the example value here determines that you can access the diagram resource at http://teamserver.example.com/api/v1/diagrams/2 .

"link"

"/object/view.spg?key=2"

Path relative to the Team Server root URL that points to the page of the diagram.

For example, if the Team Server root URL is http://teamserver.example.com , the example value here determines that you can access the page of the diagram at http://teamserver.example.com/object/view.spg?key=2 .

"createdAt"

1369928964

The date when the diagram was created, in Unix time (seconds since 1970).

"models"

[ { "id": "5", "link": "/object/view.spg?key=5", "name": "Adventure Works", "type": "Physical", "url": "/v1/models/5" }, // … ]

A list of models that are children of the diagram. Each entry provides the following fields:

  • id
  • name
  • image
  • url
  • link

See the Model API for more information.

"type"

"Diagram"

The type of the resource. Its value is always "Diagram" for diagram resources.

Example Response

This is an example response from a GET v1/diagrams call:

{
    "metadata_": {
        "limit": 25,
        "totalCount": 3,
        "offset": 0
    },
    "diagrams": [
        {
            "models": [
                {
                    "id": "5",
                    "link": "/object/view.spg?key=5",
                    "name": "Adventure Works",
                    "type": "Physical",
                    "url": "/v1/models/5"
                },
                // …
            ],
            "id": 2,
            "author": "Product Management",
            "createdAt": 1369928964,
            "company": "My Company",
            "link": "/object/view.spg?key=2",
            "name": "Adventure Works.DM1",
            "fileName": "Adventure Works.DM1",
            "type": "Diagram",
            "url": "/v1/diagrams/2",
            "version": "1.1"
        },
        // …
    ]
}

This is from a GET v1/diagrams/<id> call:

{
    "diagram": {
        "models": [
            {
                "id": "5",
                "link": "/object/view.spg?key=5",
                "name": "Adventure Works",
                "type": "Physical",
                "url": "/v1/models/5"
            },
            // …
        ],
        "id": 2,
        "author": "Product Management",
        "createdAt": 1369928964,
        "company": "My Company",
        "link": "/object/view.spg?key=2",
        "name": "Adventure Works.DM1",
        "fileName": "Adventure Works.DM1",
        "type": "Diagram",
        "url": "/v1/diagrams/2",
        "version": "1.1"
    }
}

See Also