Views
| Call | Gives |
|---|---|
GET /v1/projects/{projectId}/views |
Every diagram, catalog, board and chart view, with what each shows |
GET /v1/diagrams/{diagramId} |
A diagram’s shapes, connectors and links to other views |
GET /v1/diagrams/{diagramId}/drawing |
Everything the diagram shows, to draw it as the app does |
The list gives every view of the project, diagrams first, then catalogs, boards and chart views. kind keeps one kind, and packageId keeps the views kept directly in a package. Each view gives its name, package and notes, and what it shows:
- Catalogs and boards:
type, the element type they list. A board also givesgroupBy, the property type whose values make its columns. - Catalogs, boards and chart views:
scope, the part of the project they show. Each rule names a package and whether it’s included; the nearest rule on a package or above it decides.nullmeans every model.
Catalog rows and board cards aren’t given yet. To read what a catalog shows, list the elements of its type with their values (GET /v1/projects/{projectId}/elements?type=…&include=properties), and keep those in its scope. Calls that give the rows exactly as the app arranges them may follow when programs need them.
Diagrams
Section titled “Diagrams”GET /v1/diagrams/{diagramId} gives the diagram’s:
nodes: each shape, with the element it draws (idandname), its position and size (x,y,width,height, in the diagram’s own units), andparentElementIdwhen it’s drawn inside another element’s shape.edges: each connector, with the relationship it draws, the shapes it joins (sourceNodeId,targetNodeId) and its bend points (waypoints), in order from source to target.links: each link to another view, with the view it opens (kindandid) and its label.
This is the diagram’s structure. To draw it, use its drawing data, below.
Drawing a diagram
Section titled “Drawing a diagram”GET /v1/diagrams/{diagramId}/drawing gives everything the diagram shows, so a program can draw it exactly as the app does: in a report, a document, a web page.
| Part | Gives |
|---|---|
shapes |
Each shape: its element (id, name, type), position and size, the shape it’s drawn inside (parentShapeId), its final colours (fill, border, text, fold) in light and dark, border, shadow, text alignment, label placement, its values when the diagram shows compartments, what it owns, its attachment, child diagrams, and whether it fits its metamodel |
connectors |
Each connector: its relationship, the shapes it joins (from, to), routing and bend points, final line and label colours, width, pattern, its label text, role names and multiplicities |
types |
Each type used, once, keyed by id: its notation already worked out (shape, fill mode, border, markers, compartments, property types) |
icons |
Each type’s icon, once, as SVG, keyed by the type’s icon |
links |
Each link to another view |
diagram.settings |
What the diagram shows: connectors, connector labels (name, verb, none), compartments, stereotypes |
Good to know:
- As saved. Nobody’s unsaved changes, and no selection.
- Both themes. Every colour is given for
lightanddark; pick one. A connector’s label colour isnullwhen it uses the theme’s label colours. - Shapes and connectors that don’t fit their metamodel (
fitsMetamodel: false) are drawn as the app draws them: their colours are the theme’s muted ones, andopacityis 0.4. Every other shape and connector hasopacity1. - Values are in their natural types, as an element’s values are.
- Attachment images are never sent as addresses: fetch one from the shape’s
attachment.href, with your key. - Redraw only what changed.
versionchanges whenever anything drawn changes, and is also theETag. Send it back inIf-None-Matchexactly as you received it (a compressed answer’s tag is weak,W/"…"), and an unchanged diagram answers 304 with no body. - Format
farkitect-drawing/1. Fields may be added within it, as anywhere in the API.
To turn this answer into the picture, the same as the app draws it, use Farkitect’s drawing package or the farkitect-render tool: see Drawing a diagram in your program.