Forum Discussion

Kayle's avatar
Kayle
New Contributor
2 years ago

How to attach a file to the case step result?

I want to use API to attach a file to the case step. But I do not find an API. Can you help me? If you need more information please tell me. THX

 

 

 

  • I resolved the question.

     

    BaseUrl/rest/zapi/latest/attachment?entityId=664272&entityType=TESTSTEP&projectId=19800
    session = requests.session()
    headers = {
    "Authorization": "Basic *****",
    "X-Atlassian-Token": "no-check"
    }



    response = session.post(url, headers=headers, files={
    "file": ("expect.jpg", open("expect.jpg", "rb"), "image/jpeg")
    })

     

  • Kayle's avatar
    Kayle
    New Contributor

    I resolved the question.

     

    BaseUrl/rest/zapi/latest/attachment?entityId=664272&entityType=TESTSTEP&projectId=19800
    session = requests.session()
    headers = {
    "Authorization": "Basic *****",
    "X-Atlassian-Token": "no-check"
    }



    response = session.post(url, headers=headers, files={
    "file": ("expect.jpg", open("expect.jpg", "rb"), "image/jpeg")
    })