I'm trying to fetch all the discussions for a given defect using Python rally API but failed, below code doesn't work,
from pyral import Rally
defect_id = 'DE12345'
rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
defect = rally.get('ConversationPost', query='FormattedID = %s' % defect_id, instance=True)
Does anyone know the right way to achieve this? Thanks!
Since your request is pulling back ConversationPosts, the query is therefore filtering on the Formatted ID of the ConversationPost, not the ID of the Defect that the Discussion may be associated with.
To target the Formatted ID of the Defect that the Discussions are associated with, use this instead:
query='Artifact.FormattedID = %s'
Note that we're specifying 'Artifact' and not 'Defect' here because a Discussion can be associated with any type of artifact (User Story, Portfolio Item, etc...).