> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/services-api-classic.md).

# Services API (classic)

## Overview <a href="#servicesapi-classic-overview" id="servicesapi-classic-overview"></a>

The *Services API* lets you programmatically retrieve data about the health of the IT services that you monitor with Nexthink.

The client of the Services API must trust the certificate in the primary Appliance (Portal).

To authenticate the client, the Service API uses Basic Authentication. Nexthink recommends creating a local account to exclusively authenticate clients of the API.

## Enabling the Services API <a href="#servicesapi-classic-enablingtheservicesapi" id="servicesapi-classic-enablingtheservicesapi"></a>

The Services API is fully tested and can be used in production. However, it is still in the phase of technical preview and you need to activate the feature before being able to use it.

To enable the Services API:

1. Log in to the CLI of Portal Appliance.
2. Optional: If Portal has no configuration file yet, that is, if `portal.conf` does not exist in folder `/var/nexthink/portal/conf`, create it by copying the defaults from the sample configuration file: `sudo -u nxportal cp /var/nexthink/portal/conf/portal.conf.sample \`\
   `/var/nexthink/portal/conf/portal.conf`
3. Edit Portal configuration file: `sudo vi /var/nexthink/portal/conf/portal.conf`
4. Add the following line: `globalconfig.feature.service-test-api = true​`
5. Save your changes and exit: `:wq`
6. Restart Portal to apply your settings: `sudo systemctl restart nxportal`

## Finding out available service data <a href="#servicesapi-classic-findingoutavailableservicedata" id="servicesapi-classic-findingoutavailableservicedata"></a>

To interactively look for service data that is available through the Services API:

1. Navigate with a web browser to the following address:

   ```
   https://<Portal_DNS_FQDN>/api/beta/services
   ```

   * Substitute `<Portal_DNS_FQDN>` for the actual name of Portal.
2. Log in to the discovery tool of the Services API:
   * Type in the user credentials whenever asked by the web browser.
   * The discovery tool displays the service data limited to the [view domain of the user](https://github.com/nexthink/documentation.online/blob/review/docs/Establishing-a-privacy-policy/README.md#limiting-the-view-to-a-domain_94994462.md) in the hierarchy.

## Querying the API <a href="#servicesapi-classic-queryingtheapi" id="servicesapi-classic-queryingtheapi"></a>

To query the Services API, send a GET request to the API URL with the following parameters:

| Parameter                                 | Description                                                                                                                                          | Default value                                   |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| service (named **metric** in the request) | UID of the desired service                                                                                                                           | (none)                                          |
| scope                                     | <ul><li><strong>hour</strong> (last 60 minutes)</li><li><strong>day</strong> (last 24 hours)</li></ul>                                               | <ul><li><strong>hour</strong></li></ul>         |
| hierarchy                                 | Name of a hierarchy                                                                                                                                  | The name of the first hierarchy in Portal       |
| hierarchy-level                           | Name of a level in the hierarchy                                                                                                                     | (none)                                          |
| path                                      | Name of a node in the hierarchy to limit the output. Chain several path elements to limit the output further down in the hierarchy levels.           | The highest node in the view domain of the user |
| format                                    | <p>Output format, one of:</p><ul><li><strong>table</strong> (for an HTML table)</li><li><strong>json</strong></li><li><strong>csv</strong></li></ul> | **table**                                       |

* Include either the **hierarchy-level** or the **path** parameter in a Services API query, but not both simultaneously.

Example of a query URL:

```
https://<Portal_DNS_FQDN>/api/beta/service/data/overview?​
metric=57dc824c-3507-434a-9658-2d98255c1eff&​
hierarchy=Location&​
path=Europe&path=Switzerland&​
format=table​
```

\
The Services API uses Basic Authentication. To test the API from a Nexthink appliance, you can use `curl`, for instance:

```
curl https://<Portal_DNS_FQDN>/api/beta/service/data/overview?... -u username:password
```

## Output of the Services API <a href="#servicesapi-classic-outputoftheservicesapi" id="servicesapi-classic-outputoftheservicesapi"></a>

The data that you can retrieve from the Services API is similar to what you get when [analyzing the health of a service](/platform/user-guide/using-finder-classic/monitoring-it-services-classic/analyzing-service-quality-classic.md) from the corresponding [dashboards in ](/platform/user-guide/using-finder-classic/monitoring-it-services-classic/following-the-evolution-of-a-service-classic.md)Portal.

Find below the complete list of outputs of the Services API:

| Output data                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name of service                     | The name of the selected service                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Names of hierarchy levels and nodes | <ul><li>For a <strong>hierarchy-level</strong> query, the response returns service data decomposed into all the nodes at the specified level and includes an aggregate result named <strong>all</strong> for each node at the parent level (which is the global level for levels defined at the top of the hierarchy).</li><li>For a <strong>path</strong> query, the response includes service data for the node specified (grouped on the entry named <strong>all</strong>) and its immediate children; except for nodes at the Entity level, which are at the base level of the hierarchy and do not have children.</li></ul> |
| Service metrics                     | The service metrics depend on the service being connection-based or web-based and are the same that you can find on the service dashboards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

***

RELATED TASKS

* [Analyzing service quality](/platform/user-guide/using-finder-classic/monitoring-it-services-classic/analyzing-service-quality-classic.md)
* [Following the evolution of a service](/platform/user-guide/using-finder-classic/monitoring-it-services-classic/following-the-evolution-of-a-service-classic.md)

RELATED CONCEPT

* [Service](/platform/references/references-classic/glossary-classic/service-classic.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexthink.com/platform/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/services-api-classic.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
