louislam / uptime-kuma

A fancy self-hosted monitoring tool

Home Page:https://uptime.kuma.pet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

be able to run tests on a postman style request

armandofcom opened this issue Β· comments

πŸ“‘ I have found these related issues/pull requests

being able to do surveys on the results returned by an example get request that returns a json and parse that json and create some queries, how we do a test in postman, example

var data = JSON.parse(responseBody);
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
console.log(new Date().getTime()-Date.parse(data.items[0].lastConnection));

pm.test("Last Connection Date", function () {
    pm.expect(new Date().getTime()-Date.parse(data.items[0].lastConnection)).to.be.below(480000);
});

🏷️ Feature Request Type

New monitor

πŸ”– Feature description

being able to do surveys on the results returned by an example get request that returns a json and parse that json and create some queries, how we do a test in postman, example
Captura de pantalla 2024-04-12 a las 12 54 28β€―a m

βœ”οΈ Solution

You should also keep in mind that it is possible that a new authentication method must be passed, which may be that you send a POST-style request where you send a raw style json and that you parse that response so that it can be used to consult the api or the enpoint a monitor

var data = JSON.parse(responseBody);
//postman.setEnvironmentVariable("token", data.token);
pm.globals.set("token", data.token);
Captura de pantalla 2024-04-12 a las 12 53 22β€―a m
Captura de pantalla 2024-04-12 a las 12 53 28β€―a m
Captura de pantalla 2024-04-12 a las 12 54 18β€―a m

❓ Alternatives

No response

πŸ“ Additional Context

No response

I think with "survey" you mean you want to execute queries against json.
Have you looked at the json-query monitor, which does exactly what you are proposing (doing a request, checking the result).

Unsure what you mean by

You should also keep in mind that it is possible that a new authentication method must be passed, which may be that you send a POST-style request where you send a raw style json and that you parse that response so that it can be used to consult the api or the enpoint a monitor

Yes, I already saw that with queries to that json it might work for me, I am investigating more to see if that would work, and with respect to authentication I mean that right now I have to send the following header that I obtained from the login

{
     "Authorization": "Bearer *******"
}

Given that you can attach said header, I think this issue is resolved