NEXUS IC Examples — pynexusic 2.5.0 documentation

# NEXUS IC Examples

Example 1: Get system version

> 1. Import `NEXUSIC_RESTAPI`

>    >     from pynexusic import NEXUSIC_RESTAPI as api

> 2. Initialize `NEXUSIC_REST` class

>    >     NX_REST = api.NEXUSIC_REST(baseURI, api_key=APIKey)

>    > where APIKey is the user’s API Key provided by the system administrator

> 3. Execute required function

>    >     result, result_status_code = NX_REST.getVersion()

>    > Output:

>    >     result = {'version': 'x.x.xxxxx.x', 'schema': 'x.xxx'}
>    >     result_code = 200

Example 2: Run reports and get python object response

> 1. Import `NEXUSIC_RESTAPI`

>          from pynexusic import NEXUSIC_RESTAPI as api

> 2. Initialize `NEXUSIC_REST` class

>    >     NX_REST = api.NEXUSIC_REST(baseURI, api_key=APIKey)

>    > where APIKey is the user’s API Key provided by the system administrator

> 3. Execute required report

>    >     result, result_status_code = NX_REST.getDashboard(report_name)

>    where report_name is the name of the report to be executed in NEXUS IC

>    > Output:

>    >     result = {'name': 'xxxxxxxxxxx',
>    >               'elements': [{'type': 'section', 'data': {}},
>    >                            {'type': 'paragraph', 'data': {'text': [{'value': 'xxxxxx'}]}}
>    >                           ]
>    >               }
>    >     result_code = 200

>    > The values of the elements key will contain the data configured in the NEXUS IC report template