@@ -352,6 +352,91 @@ def list_questions_example(j1):
352352 except Exception as e :
353353 print (f"Error listing questions: { e } " )
354354
355+ def get_question_details_example (j1 ):
356+ """Demonstrate getting specific question details."""
357+
358+ print ("=== Get Question Details Example ===\n " )
359+
360+ print ("First, let's get a list of questions to find one to examine:" )
361+ try :
362+ questions = j1 .list_questions ()
363+
364+ if questions :
365+ # Get details of the first question
366+ first_question = questions [0 ]
367+ question_id = first_question ['id' ]
368+ question_title = first_question ['title' ]
369+
370+ print (f"Getting detailed information for question: { question_title } " )
371+ print (f"Question ID: { question_id } " )
372+
373+ # Get full question details
374+ question_details = j1 .get_question_details (question_id = question_id )
375+
376+ print (f"\n Detailed Question Information:" )
377+ print (f" Title: { question_details ['title' ]} " )
378+ print (f" ID: { question_details ['id' ]} " )
379+ print (f" Source ID: { question_details .get ('sourceId' , 'Not specified' )} " )
380+ print (f" Description: { question_details .get ('description' , 'No description' )} " )
381+ print (f" Tags: { ', ' .join (question_details .get ('tags' , []))} " )
382+ print (f" Last Updated: { question_details .get ('lastUpdatedTimestamp' , 'Not specified' )} " )
383+ print (f" Account ID: { question_details .get ('accountId' , 'Not specified' )} " )
384+ print (f" Show Trend: { question_details .get ('showTrend' , False )} " )
385+ print (f" Polling Interval: { question_details .get ('pollingInterval' , 'Not set' )} " )
386+
387+ # Display queries
388+ queries = question_details .get ('queries' , [])
389+ print (f"\n Queries ({ len (queries )} ):" )
390+ for i , query in enumerate (queries ):
391+ print (f" Query { i + 1 } : { query .get ('name' , 'Unnamed' )} " )
392+ print (f" - Query: { query .get ('query' , 'No query' )} " )
393+ print (f" - Version: { query .get ('version' , 'Not specified' )} " )
394+ print (f" - Results Are: { query .get ('resultsAre' , 'Not specified' )} " )
395+
396+ # Display compliance information
397+ compliance = question_details .get ('compliance' )
398+ if compliance :
399+ print (f"\n Compliance Information:" )
400+ if isinstance (compliance , dict ):
401+ print (f" Standard: { compliance .get ('standard' , 'Not specified' )} " )
402+ requirements = compliance .get ('requirements' , [])
403+ if requirements :
404+ print (f" Requirements: { ', ' .join (map (str , requirements ))} " )
405+ controls = compliance .get ('controls' , [])
406+ if controls :
407+ print (f" Controls: { ', ' .join (map (str , controls ))} " )
408+ else :
409+ print (f" Compliance data type: { type (compliance )} " )
410+ print (f" Compliance content: { compliance } " )
411+ else :
412+ print (f"\n Compliance Information: None" )
413+
414+ # Display variables
415+ variables = question_details .get ('variables' , [])
416+ if variables :
417+ print (f"\n Variables ({ len (variables )} ):" )
418+ for var in variables :
419+ print (f" - Name: { var .get ('name' , 'Unnamed' )} " )
420+ print (f" Required: { var .get ('required' , False )} " )
421+ print (f" Default: { var .get ('default' , 'None' )} " )
422+ else :
423+ print (f"\n Variables: None" )
424+
425+ # Display integration information
426+ integration_def_id = question_details .get ('integrationDefinitionId' )
427+ if integration_def_id :
428+ print (f"\n Integration Definition ID: { integration_def_id } " )
429+ else :
430+ print (f"\n Integration Definition ID: None" )
431+
432+ else :
433+ print ("No questions found in the account to examine" )
434+
435+ except Exception as e :
436+ print (f"Error getting question details: { e } " )
437+ print (f"Error type: { type (e ).__name__ } " )
438+ print (f"Error details: { str (e )} " )
439+
355440def question_use_cases (j1 ):
356441 """Demonstrate real-world use cases for questions."""
357442
@@ -430,6 +515,9 @@ def main():
430515 time .sleep (1 )
431516
432517 list_questions_example (j1 )
518+ time .sleep (1 )
519+
520+ get_question_details_example (j1 )
433521
434522 question_use_cases (j1 )
435523
0 commit comments