15 Nov 2023 01:00 PM
Hi all,
Please let me know anyone has written python script to export Problems data from API V2.
API V2-> Problems -> List problems observed within the specified time frame.
Challenge I faced : with evidenceDetails field we can export only 10 problems once, suppose I have 1000 problems in last 1 month then I have to run this API 100 times manually with nextPage key.
Please help.
Thanks.
Solved! Go to Solution.
16 Nov 2023 04:32 AM - edited 16 Nov 2023 04:33 AM
Hi,
You can use Bash, Perl, Python, Go, Ruby, Powershell... Almost all languages have libraries do make HTTP requests and parse JSON answer.
Something to explore would be using DQL to get Davis AI information. You do not need programming skills for that.
Best regards
16 Nov 2023 10:22 AM
Hi @gurugogi
Try to use the code from the attached file
HTH
Yos
16 Nov 2023 11:03 AM
Hi @Yosi_Neuman
Thanks for providing script.
Iam getting certificate error "urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1007).
Please check attach output.
"
16 Nov 2023 11:36 AM
I used verify=true in "requests.get" and certificate error is fixed now but script is not getting completed just its keep on running in loop.
PFA snapshot.
16 Nov 2023 01:56 PM - edited 16 Nov 2023 03:09 PM
Hi @gurugogi
My bad, gave you a not complete code ..... try the attached one see if its works for you
Just tried that with 10 days and its look like its working
Yos
16 Nov 2023 03:40 PM
@Yosi_Neuman Script is working now, thanks.
Does it include problems with "evidenceDetails" field
16 Nov 2023 05:00 PM
You are welcome @Gogi
In order to include evidenceDetails please add , "fields" : 'evidenceDetails' to request_params
HTH
Yos
17 Nov 2023 04:02 AM
I have added fields" : 'evidenceDetails' to request_params, still I see same columns is csv, please refer attached snapshot.
whether its possible to add one more column to print ProblemID?
Thanks.
18 Nov 2023 04:37 PM - edited 18 Nov 2023 04:41 PM
Here it goes
19 Nov 2023 05:14 AM
Awesome script @Yosi_Neuman
We have python scripts to export Problem data as well but haven't found a efficient way to parse nextKeyPages. Will definitely be taking a look at what you've set up and improve ours.
Cheers,
Steven
19 Nov 2023 07:33 PM
Happy to assist @steven_v
19 Nov 2023 06:52 AM
Thanks its working.
please is it possible to add Problem selector filed also , I want to export problems data based on MZ names so that we will have problems count for each application in last 1 mont.
Management zone ID: managementZoneIds("mZId-1", "mzId-2").
Management zone name: managementZones("value-1","value-2")
Thanks
19 Nov 2023 07:34 PM
Hi @gurugogi
With the attached py you can add MZ as 3ed parameter (only one at a time)
HTH
Yos