API access is available to users via their JWT bearer token, or can be made available to a backend system via an M2M token issued by InnerSpace.
Developer Access
Contact sales@innerspace.io for developer access. They will provide you with a ClientID and ClientSecret.
They will need to know the usage of the credentials - whether it is needed for a backend service, a native application, a single-page web app or regular web app.
import loggingimport sysfrom gql import gql, Clientfrom gql.transport.aiohttp import AIOHTTPTransportfrom gql.transport.aiohttp import log as requests_loggerrequests_logger.setLevel(logging.WARNING)defmain(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)