Back to ITRS Internal Only FAQ

Internal documentation only

This page has been marked as draft.

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries

It is possible to Query Gateway-Hub dataviews via the Rest-API interface

The interface will be located at

https://yourhostname:port/v0/endpoint

And might have different endpoints.

You can see the different endpoints available and example with the queries by accessing the “swagger” endpoint via your browser

https://yourhostname:port/v0/swagger

Example:

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

Now, lets try to see how we would be extracting the data of this dataview,

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

Lets try to extract the values of the column ‘LON’

To start with, lets do a right click on the value cell for the column ‘LON’ and select in the Chrome browser ‘inspect’

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

In the ‘DevTools’ in the right hand side, select ‘Network’

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

Now refresh the page on the Gateway-Hub Dataview

In the new ‘DevTools’ view, under the ’name’ column look for “recordsQuery” and under the columns ‘Headers’, ‘Payload’ and ‘Response’ you will have the information you will need to formulate the Json

In Headers: You will find the Endpoint to send your json query.

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

In Payload: You will see the payload that was sent.

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

In Response: You will see what was replied to the browser

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

Now we know that we have to request to URL /events/recordsQuery via a POST method looking at the headers information.

If we go back to ‘swagger’ page and to to the section ’events/recordsQuery’ we can see an example of the post json structure.

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

With the information from the ‘attributes’ of the Gateway-HUB page and the information gathered before we can now formulate our json query

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

Here is our json to post to the endpoint and we are going to query the attribute type “itrs” and with ’name’ Trades.

{

  "skip": 0,

  "filter": {

    "entities": "itrs.name=Trades",

    "range": {

      "from": "2023-05-24T00:00:00Z",

      "to": "2023-05-24T23:00:00Z"

    }

  },

  "zoneId": "Europe/Madrid",

  "limit": 10,

  "events": [

    "severity:warning",

    "severity:critical",

    "snooze",

    "userassignment:false"

  ],

  "metrics": ["Trades/Trades/{rowname}/LON"]

}

and this would be the response

 {

            "type": "severity",

            "timestamp": "2023-05-24T00:25:20.246Z",

            "entityId": 0,

            "metric": "Trades/Trades/Volume/LON",

            "data": {

                "value": {

                    "cell": "32454",

                    "number": 32454.0

                },

                "active": true,

                "snoozed": false,

                "severity": "CRITICAL",

                "userAssigned": false,

                "snoozedParents": 0,

                "previousSeverity": "OK",

                "tickerEventInterest": true

            }

You can use ‘Postman’ to process the post message and see the response.

[INTERNAL] Gateway-HUB - How to troubleshoot Rest-API queries.

["Geneos"] ["FAQ"]

Was this topic helpful?