RESTful API

The RESTful API is the interface through which the web application gets all data but it may be also used to access the served trajectory data from other applications.

File content

To retrieve a file from data_dir <root> with file path <filename> call:

/file/<root>/<filename>

Directory content description

To get a JSON description of available data_dir directories call:

/dir/
To get a JSON description of the directory content in data_dir <root> call:
/dir/<root>/
To get a JSON description of the directory content in data_dir <root> at path <path> call:
/dir/<root>/<path>
The JSON description is a list of file or sub-directory entries:

[
    {
        "name": "name of sub-directory",
        "path": "path relative to <root>",
        "dir": "true if entry is a directory",
        "restricted": "true if access is restricted"
    },
    {
        "name": "name of the file",
        "path": "path relative to <root>",
        "size": "file size in bytes"
    },
    {
        ...
    }
]

Frame count

To get the number of frames the trajectory in data_dir <root> with file path <filename> has call:
/traj/numframes/<root>/<filename>

Frame coordinates

To get the coordinates of frame number <frame> of the trajectory in data_dir <root> with file path <filename> call:
/traj/frame/<frame>/<root>/<filename>
The set of atoms for which coordinates should be returned can be restricted by POSTing an atomIndices parameter with the following format. A list of index ranges is defined by pairs of integers separated by semi-colons (;) where the two integers within a pair are separated by a comma (,). To select atoms with indices (starting at zero) 5 to 10 and 22 to 30 send: 5,10;22,30 The coordinate frame is returned in binary format and also contains the frame number, the simulation time (when available) and the box vectors.
| Offset | Size |  Type | Description                  |
| -----: | ---: | ----: | :--------------------------- |
|      0 |    4 |   int | frame number                 |
|      4 |    4 | float | simulation time              |
|      8 |    4 | float | X coordinate of box vector A |
|     12 |    4 | float | Y                            |
|     16 |    4 | float | Z                            |
|     20 |    4 | float | X coordinate of box vector B |
|     24 |    4 | float | Y                            |
|     28 |    4 | float | Z                            |
|     32 |    4 | float | X coordinate of box vector C |
|     36 |    4 | float | Y                            |
|     40 |    4 | float | Z                            |
|     44 |    4 | float | X coordinate of first atom   |
|     48 |    4 | float | Y                            |
|     52 |    4 | float | Z                            |
|    ... |  ... |   ... | ...                          |

More

If you have any questions, found some bugs, or want to report enhancement requests use the Issue Tracker, use the contact formular or write a mail to johanna.tiemann@gmail.com or alexander.rose@weirdbyte.de.

Please give us feedback!

top