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

nextPageKey syntax?

Lisa_Singh01
Participant

Sorry new to Dynatrace so perhaps a silly question...
Does anyone have an example of using curl and the Rest API with the "nextPageKey" parameter to fetch more than 1000 results when pulling down metrics?

 

16 REPLIES 16

skrystosik
DynaMight Guru
DynaMight Guru
nextPageKey you should add via query parameter. So there isn'y any magic here 🙂 just add https://uri?nexyPageKey=value

This value you should read from previous response.

Sebastian


Regards, Sebastian

Thank you Sebastian!

I can see that from the API Explorer as well, but still not quite wrapping my head around it. Do I need to add a header parameter that first specifies what the key is (in a similar way to adding the authorisation key) then follow that with nextPageKey=(value I just put in the header)?


No, you don't need. Just add nextPageKey to url as in my example. Nothing more. First request you can execute without this parameter (you will see value for it in response). Than read this value from first response (and all next) and just add it to url.

Sebastian


Regards, Sebastian

Sorry I am still being thick I think. What do I put in for "value" in nextPageKey=value - or just use the word value not an actual value?


Value is string that you receive from previous request. You should put there next page indicator returned in response. Treat value as placeholder here 🙂


Regards, Sebastian

Thank you! Now back to learning enough scripting to parse that into the next request.

New at all this, many thanks for your help.


If you will have any extra questions, please ask 🙂

Sebastian


Regards, Sebastian

Malaik
DynaMight Champion
DynaMight Champion

Hello all
Hello @skrystosik, i dont understand well

What is the exact value to put?

 

And what is the parameter if I have more than @ pages (2500 results for example)

 

Thanks for your help.

Sharing Knowledge

@Malaik In the current results, you have a nextPageKey value in the JSON response. You just need to put this value into URL query parameter named nextPageKeyto fetch the next page of the resultset.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Malaik
DynaMight Champion
DynaMight Champion

Thanks @Julius_Loman Yes done

But the documentation is not well done because we must to omit also the optional options.

I used it, but the result was return a count of 3500 but only 500 items was in the json

 

Have a good day.

Sharing Knowledge

Hello,

 

I'm in same case. I don't see where nextPageKey value is. 

I try to code something like that :

 

r = requests.get('https://%s/e/%s/api/v2/settings/objects?schemaIds=builtin:host.monitoring&fields=objectId,value,scope?nextPageKey' % (cfg["dynatrace_host"], cfg["dynatrace_id"]), headers=h, verify=False)

 

But in header or json i didn't see value for nextPageKey. 

 

Can you tell me where to find the value?

 

Best regard 

 

MaciejNeumann
Community Team
Community Team

Hello Lisa! There is no such thing as a silly question, as every each of us was new to Dynatrace at some point. If you have any doubts about some topic, don't be shy and ask about it. Our community is very active and I'm sure that someone will help you with it 🙂


If you have any questions about the Community, you can contact me at maciej.neumann@dynatrace.com

Machindra220
Visitor

So, following is my response of first GET API (Lists All Event Properties)

Response Body

 

{
  "totalCount": 24,
  "pageSize": 24,
  "eventProperties": [
    {
      "key": 
      "display Name": "Allow Davis merge",
      "description": "Allow Davis AI to merge this event into existing problems (true) or force creating a new problem (false)",
      "writable": true
    },
    {
      "key": "",
      "display Name": "Baseline affected service method",
      "description": "Lists affected service methods of the triggered service event",
      "writable": false
    },
    {
      "key": "",
      "display Name": "Baseline total load",
      "description": "The load (calls per minute) of the entire service or application for triggered event",
      "writable": false
    },
    {
      "key": "",
      "display Name": "Custom description",
      "description": "The textual description of the event",
      "writable": true
    },
    {
      "key": "d",
      "display Name": "Event group label",
      "description": "A label which represents a sub-group of the event type",
      "writable": true
    },
    {
      "key": "d",
      "display Name": "Relevant for root cause analysis",
      "description": "A hint for Davis AI which indicates if an event is relevant during root cause analysis",
      "writable": true
    },
    {
      "key": "dt",
      "display Name": "Log query",
      "description": "The log query pattern which is relevant for the triggered event",
      "writable": false
    },
    {
      "key": "maintenance",
      "display Name": "Maintenance window ids",
      "description": "Lists matching maintenance window ids for the triggered event",
      "writable": false
    },
    {
      "key": "dt",
      "display Name": "Private location health state",
      "description": "Health state of private locations attached to monitor",
      "writable": false
    }
  ]
}
---------------------

Response Headers:

----------------------------

cache-control: no-store, no-cache  content-encoding: g zip  content-length: 1066  content-type: application/json; charset=utf-8  date: Mon, 27 Dec 2021 13:09:11 GMT  pragma: no-cache  server: ruxit server  server-timing: dtRpid;desc="1809847407", dtS Info; desc ="0"  strict-transport-security: max-age=31536000;includeSubDomains  vary: Accept-Encoding  x-oneagent-js-injection: true  x-robots-tag: noindex 

 

Which is the "nextPageKey" from this response?

You don't have a nextPageKey in the result, since all the items were returned in the response already. nextPageKey is present if the result could not fit the response (too many results).

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

DavidF
Participant

I simply cannot get this to work.

HannahM
Dynatrace Leader
Dynatrace Leader

What have you tried?

 

Synthetic SME and community advocate.

Featured Posts