Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2020-04-29 13:39:16

steve
Third Light Staff
Registered: 2013-06-06
Posts: 90

Retrieving ids and other details from the JavaScript console

Save time by using your browser's JS console to lookup the details of various elements within your Chorus site via the Internal API. These convenience functions can help to find the ids of items that need to be passed as arguments to the REST API endpoints.

Here are a few examples:

1) Returning the GUID of the current location you have browsed to within Chorus

chorus.ctx.currentLocation().value

This returns a value similar to the following:

"6d3ae6c2-0491-11ea-bab9-000c291bbc26"

2) Display the details of a selected space, folder or file

Return details of the first item selected:

chorus.asset

The long version of chorus.asset but will log an array of details for the entire selection:

chorus.A(chorus.ctx.selectedAssets.all()).log()

Return just the guid(s) of the selection:

chorus.ctx.selectedAssets.all()

Show details of the selected GUID:

chorus.m.Core.GetDetails("<guid>")

In the output returned id refers to the GUID and reference is the value display on the file preview page of an asset

3) Display the details of all the containers within a parent space

chorus.m.Folders.GetContainersForParent({containerId: "<guid>"});

4) Display the details of the user account currently logged into the browser

chorus.env.get("user")

Individual details can be retrieved like this

chorus.env.get("user.id")
chorus.env.get("user.username")

Offline

Board footer