It is possible to use the Get a map's table of contents web service to display a document's ToC.
The JSON output returns the list of the topics contained in the map, as for the /api/khub/maps/$MAP_ID/topics
web service. The difference is that the Get a map's table of contents web service returns the topic's hierarchy in the given map.
For instance, for the Time Machine User Guide
map, the structure of topics is as follows:
Time Machine User Guide
├── Introduction to Time Machines
└── How to Time Travel
├── Set Local Date and Time
├── Set Destination Date and Time
└── Set a Destination Location
The Get a map's table of contents web service returns the following information:
[
{
"tocId": "O9UowuYCBjsp~FGKTUFx5w",
"contentId": "huzBwbbBW3WzTGHwshZIHg",
"title": "Introduction to Time Machines",
"children": []
},
{
"tocId": "cwM7YaPiO14KSK2ijkpHBg",
"contentId": "tCXkAmF0SVEScehmnX5TiQ",
"title": "How to Time Travel",
"children": [
{
"tocId": "Ras6kFhn0~2wpgeDUws7uQ",
"contentId": "PC10RJwTtnxkpIm9hbkRdA",
"title": "Set Local Date and Time",
"children": []
},
{
"tocId": "QZUh1xB~yrDANJ2e~ti9pg",
"contentId": "hDs56CtGixP~R1hf~1tB_g",
"title": "Set Destination Date and Time",
"children": []
},
{
"tocId": "mYhIZEwLYgllseZJxu2yxA",
"contentId": "ZYYuXA2e~06xnuQoChsvBA",
"title": "Set a Destination Location",
"children": []
}
]
}
]