Problems export script

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.

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

Hi @gurugogi

Try to use the code from the attached file

HTH

Yos 
FeatchProblems.py.txt (3.2 KB)

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.

"
py-error-logs-dt.txt (4.67 KB)

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.

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 
FeatchProblems.py.txt (3.83 KB)

@Yosi_Neuman Script is working now, thanks.

Does it include problems with “evidenceDetails” field

You are welcome @Gogi

In order to include evidenceDetails please add , “fields” : ‘evidenceDetails’ to request_params

HTH

Yos

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.

Here it goes 
FeatchProblems.py.txt (4.22 KB)

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

@Yosi_Neuman

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

Happy to assist @steven_v :fist_bump:

Hi @gurugogi

With the attached py you can add MZ as 3ed parameter (only one at a time)

HTH

Yos 
FeatchProblems.py.txt (4.47 KB)