Skip to main content

Get root

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// get root node with default options ContensisClient.nodes.getRoot().then(function(node) { // root node is available }, function(error) { console.error(error); }); // get root node with specific options ContensisClient.nodes.getRoot({ language: 'fr-FR', fields: ['title'], depth: 2 }).then(function(node) { // root node is available }, function(error) { console.error(error); });

Get node

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// get node by id ContensisClient.nodes.get('57d77dbc-49da-40ca-aaaf-3b877b69699a').then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by path ContensisClient.nodes.get('/en-GB/movies/1995/toy-story').then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by id with specific options ContensisClient.nodes.get({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', language: 'fr-FR', fields: ['title'], depth: 2 }).then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by path with specific options ContensisClient.nodes.get({ path: '/en-GB/movies/1995/toy-story', language: 'fr-FR', fields: ['title'], depth: 2 }).then(function(node) { // the node is available }, function(error) { console.error(error); });

Get nodes by entry

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// get node by entry id ContensisClient.nodes.getByEntry('ba950397-5e7c-4847-a07f-cf015b9e59cb').then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by entry const entry = { 'title' : 'An entry', sys: { id: 'ba950397-5e7c-4847-a07f-cf015b9e59cb', contentTypeId: 'movie' } }; ContensisClient.nodes.getByEntry(entry).then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by entry with specific options using the entry id ContensisClient.nodes.getByEntry({ entryId: 'ba950397-5e7c-4847-a07f-cf015b9e59cb', language: 'fr-FR', fields: ['description'] }).then(function(node) { // the node is available }, function(error) { console.error(error); }); // get node by entry with specific options using the entry ContensisClient.nodes.getByEntry({ entry: entry, language: 'fr-FR', fields: ['description'] }).then(function(node) { // the node is available }, function(error) { console.error(error); });

Get node children

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// get node children by node id ContensisClient.nodes.getChildren('57d77dbc-49da-40ca-aaaf-3b877b69699a').then(function(nodes) { // the node children are available }, function(error) { console.error(error); }); // get node children by node const node = { id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', title: 'Toy Story', path: '/en-GB/movies/1995/toy-story' }; ContensisClient.nodes.getChildren(node).then(function(nodes) { // the node children are available }, function(error) { console.error(error); }); // get node children with specific options using the node id ContensisClient.nodes.getChildren({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', language: 'fr-FR', fields: ['description'] }).then(function(nodes) { // the node children are available }, function(error) { console.error(error); }); // get node children with specific options using the node ContensisClient.nodes.getChildren({ node: node, language: 'fr-FR', fields: ['description'] }).then(function(nodes) { // the node children are available }, function(error) { console.error(error); });

Get node parent

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// get node parent by node id ContensisClient.nodes.getParent('57d77dbc-49da-40ca-aaaf-3b877b69699a').then(function(parentNode) { // the node parent is available }, function(error) { console.error(error); }); // get node parent by node const node = { id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', title: 'Toy Story', path: '/en-GB/movies/1995/toy-story' }; ContensisClient.nodes.getParent(node).then(function(parentNode) { // the node parent is available }, function(error) { console.error(error); }); // get node parent with specific options using the node id ContensisClient.nodes.getParent({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', language: 'fr-FR', fields: ['description'] }).then(function(parentNode) { // the node parent is available }, function(error) { console.error(error); }); // get node parent with specific options using the node ContensisClient.nodes.getParent({ node: node, language: 'fr-FR', fields: ['description'] }).then(function(parentNode) { // the node parent is available }, function(error) { console.error(error); });

Get node ancestor at level

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// get node ancestor with specific options using the node id ContensisClient.nodes.getAncestorAtLevel({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', startLevel: 1, language: 'fr-FR', fields: ['description'] }).then(function(ancestorNode) { // the node ancestor is available }, function(error) { console.error(error); }); // get node ancestor with specific options using the node const node = { id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', title: 'Toy Story', path: '/en-GB/movies/1995/toy-story' }; ContensisClient.nodes.getAncestorAtLevel({ node: node, startLevel: 1, language: 'fr-FR', fields: ['description'] }).then(function(ancestorNode) { // the node ancestor is available }, function(error) { console.error(error); });

Get node ancestors

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// get node ancestors by node id ContensisClient.nodes.getAncestors('57d77dbc-49da-40ca-aaaf-3b877b69699a').then(function(nodes) { // the node ancestors are available }, function(error) { console.error(error); }); // get node ancestors by node const node = { id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', title: 'Toy Story', path: '/en-GB/movies/1995/toy-story' }; ContensisClient.nodes.getAncestors(node).then(function(nodes) { // the node ancestors are available }, function(error) { console.error(error); }); // get node ancestors with specific options using the node id ContensisClient.nodes.getAncestors({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', language: 'fr-FR', startLevel: 1, fields: ['description'] }).then(function(nodes) { // the node ancestors are available }, function(error) { console.error(error); }); // get node ancestors with specific options using the node ContensisClient.nodes.getAncestors({ node: node, startLevel: 1, language: 'fr-FR', fields: ['description'] }).then(function(nodes) { // the node ancestors are available }, function(error) { console.error(error); });

Get node siblings

JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// get node siblings by node id ContensisClient.nodes.getSiblings('57d77dbc-49da-40ca-aaaf-3b877b69699a').then(function(nodes) { // the node siblings are available }, function(error) { console.error(error); }); // get node siblings by node const node = { id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', title: 'Toy Story', path: '/en-GB/movies/1995/toy-story' }; ContensisClient.nodes.getSiblings(node).then(function(nodes) { // the node siblings are available }, function(error) { console.error(error); }); // get node siblings with specific options using the node id ContensisClient.nodes.getSiblings({ id: '57d77dbc-49da-40ca-aaaf-3b877b69699a', language: 'fr-FR', fields: ['description'] }).then(function(nodes) { // the node siblings are available }, function(error) { console.error(error); }); // get node siblings with specific options using the node ContensisClient.nodes.getSiblings({ node: node, language: 'fr-FR', fields: ['description'] }).then(function(nodes) { // the node siblings are available }, function(error) { console.error(error); });

Still need help?

New support request