17 Dec 2019 10:43 AM - last edited on 25 May 2021 12:18 PM by MaciejNeumann
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?
Solved! Go to Solution.
17 Dec 2019 10:56 AM
This value you should read from previous response.
Sebastian
17 Dec 2019 11:23 AM
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)?
17 Dec 2019 11:53 AM
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
17 Dec 2019 02:32 PM
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?
17 Dec 2019 03:44 PM
Value is string that you receive from previous request. You should put there next page indicator returned in response. Treat value as placeholder here 🙂
17 Dec 2019 03:46 PM
Thank you! Now back to learning enough scripting to parse that into the next request.
New at all this, many thanks for your help.
17 Dec 2019 07:07 PM
If you will have any extra questions, please ask 🙂
Sebastian
11 Jul 2021 02:18 PM
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.
11 Jul 2021 06:30 PM
@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.
12 Jul 2021 06:41 AM - edited 12 Jul 2021 07:12 AM
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.
28 Jul 2022 04:00 PM
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
17 Dec 2019 11:08 AM
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 🙂
27 Dec 2021 04:32 PM
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?
27 Dec 2021 05:22 PM
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).
19 Jul 2023 02:22 PM
I simply cannot get this to work.
19 Jul 2023 02:25 PM
What have you tried?