API documentation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API documentation

L0 Member

Hi,

 

i want to query Mineneld using the API, in order to get indicators or information about the tool, to automate some reports.

For example, i need to know how many indicatores we have added in the last X days, or last month..., how many indicators are in some feed...

 

I know that Minemeld has an API, but I have not found documentation about it.

 

Thanks for your help.

Best regards.

M.

1 accepted solution

Accepted Solutions

L5 Sessionator

Hi @miguel.tubia,

 

I'm afraid such a documentation for the API does not exist yet. Your best choice as of today is to deep dive into the source code.

 

For example, the code at /flask/metricsapi.py contains the implementation of the "/metrics" entry point. Just perform a basic auth HTTPS call like the following one I did to get metrics for my node named "dshield_blocklist"

 

GET /metrics/dshield_blocklist HTTP/1.1
Host: myminemeld:8443
Authorization: Basic YWRtaW46bWluZW1lbGQ=

You'll get a response like:

{
    "result": [
        {
            "metric": "length",
            "values": [
                [
                    1532251260,
                    null
                ],
                [
                    1532253120,
                    null
                ],
                [
                    1532254980,
                    null
                ],
                [
                    1532256840,
                    null
                ],
                ...
            ]
        },
        {
            "metric": "update.tx",
            "values": [
                [
                    1532253120,
                    null
                ],
                [
                    1532254980,
                    null
                ],
                [
                    1532256840,
                    null
                ],
                [
                    1532258700,
                    null
                ],
                ...
            ]
        }
    ]
}

It contains samples with a timestamp and a difference from the previous sample.

 

Another chance (if you feel comfortable with UX development) is to deep dive into the minemeld-webui project and learn how these metrics are polled from the API and shown in the WebUI dashboard.

View solution in original post

1 REPLY 1

L5 Sessionator

Hi @miguel.tubia,

 

I'm afraid such a documentation for the API does not exist yet. Your best choice as of today is to deep dive into the source code.

 

For example, the code at /flask/metricsapi.py contains the implementation of the "/metrics" entry point. Just perform a basic auth HTTPS call like the following one I did to get metrics for my node named "dshield_blocklist"

 

GET /metrics/dshield_blocklist HTTP/1.1
Host: myminemeld:8443
Authorization: Basic YWRtaW46bWluZW1lbGQ=

You'll get a response like:

{
    "result": [
        {
            "metric": "length",
            "values": [
                [
                    1532251260,
                    null
                ],
                [
                    1532253120,
                    null
                ],
                [
                    1532254980,
                    null
                ],
                [
                    1532256840,
                    null
                ],
                ...
            ]
        },
        {
            "metric": "update.tx",
            "values": [
                [
                    1532253120,
                    null
                ],
                [
                    1532254980,
                    null
                ],
                [
                    1532256840,
                    null
                ],
                [
                    1532258700,
                    null
                ],
                ...
            ]
        }
    ]
}

It contains samples with a timestamp and a difference from the previous sample.

 

Another chance (if you feel comfortable with UX development) is to deep dive into the minemeld-webui project and learn how these metrics are polled from the API and shown in the WebUI dashboard.

  • 1 accepted solution
  • 6248 Views
  • 1 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!