python-taiga icon indicating copy to clipboard operation
python-taiga copied to clipboard

Add Connection of User Stories with Swimlanes and/or Epics

Open Seriousness opened this issue 1 year ago • 2 comments

I am by no means a python pro and am currently writing a small script to transfer a few thousand of Nexcloud Deck entries to Taiga. ~~I have already accomplished most things yet the python-taiga wrapper does not seem to have a way to connect UserStories to Swimlanes or Epics, does it? It would be nice if thats possible.~~

edit: it seems following solves my problem. though "related userstories" might also be relevant for others

add_user_story(
        card["title"],
        description=card["description"],
        tags= [ label["title"] for label in card["labels"] ],
        due_date=card['duedate'],
        swimlane=swimlane.id
    )
                                
# link epic to userstory
url = f"{host}/api/v1/epics/{epic.id}/related_userstories"
headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {api.token}"
    }

data = {
        "epic": epic.id,
        "user_story": user_story.id
}
                                
response = requests.post(url, headers=headers, json=data)

Seriousness avatar Feb 21 '24 17:02 Seriousness

Indeed, this would be great to have as a method to relate stories to epics. It seems it is not sufficient to set an 'epic' attribute to a UserStory - it doesn't form part of the UserStory model.

See 14.10 https://docs.taiga.io/api.html#epics-related-user-stories-create

The technique above works great as a workaround, thanks!

mig5 avatar Apr 02 '25 03:04 mig5

Sadly no time to make a contrib for this one but this is doable with the library's api client:

from taiga import TaigaAPI

api = TaigaAPI("your_url")
api.auth("username", "password")
api.raw_request.post(f"/epics/{new_epic_id}/related_userstories", payload={"epic": "epic_id", "user_story": "story_id"})

hassen-doca avatar Oct 20 '25 15:10 hassen-doca