# API Reference (v1 - deprecated)

This is a graphql API.

Insights are published for buildings, floors (site) and zones (polygon on a floorplan).

All GraphQL APIs are available at `https://metrics-api.innrspc.com`

### Example

The following example uses `building_id` `71`, which is the DEMO building.

{% code title="Python GraphQL" lineNumbers="true" %}

```python

import logging
import sys
from is_common.logging import LogManager
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
from gql.transport.aiohttp import log as requests_logger
requests_logger.setLevel(logging.WARNING)
logger = LogManager(config={"app-log-level": "INFO"})


def main(argv):
    # Select your transport with a defined url endpoint, using the auth token from above
    transport = AIOHTTPTransport(url="https://metrics-api.innrspc.com/", headers={"Authorization": "Bearer {access_token}"})

    # Create a GraphQL client using the defined transport
    client = Client(transport=transport, fetch_schema_from_transport=True)

    # Execute the query on the transport
    query = """
        query sample_graphql {
              data: building_features(
                 where: {_and: [{building_id: {_eq: 71}}, {feature_name: {_eq: "weekly_frequency_dist"}}, {granularity: {_eq: "P1W"}}, {group_id: {_eq: "all-e707b3a8-0732-49ae-9156-13ff1138540e"}}, {date_time_start: {_gte: "2024-01-01T06:00:00.000Z", _lt: "2024-01-08T06:00:00.000Z"}}]}
                  ) {
                    feature_value
                    date_time_start
                  }
            }
        """
    print(client.execute(gql(query)))


if __name__ == "__main__":
    main(sys.argv)
```

{% endcode %}
