Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3667

Python API JAMA: Put attachment to item

$
0
0

I'm facing issues with API Jama to attach an attachment to an item.

I need to automatise my jobs and use python to create items and attach zipfile to them.With the console I can create my attachment with my zip file and attach to it to my item.

But with the API Jama I don't know how I can create my attachment..

In the documentation it seems that I must use this function:

def put_attachments_file(self, attachment_id, file_path):"""    Upload a file to a jama attachment    :param attachment_id: the integer ID of the attachment item to which we are uploading the file    :param file_path: the file path of the file to be uploaded    :return: returns the status code of the call"""    resource_path = 'attachments/'+ str(attachment_id) +'/file'    with open(file_path, 'rb') as f:        files = {'file': f}        try:            response = self.__core.put(resource_path, files=files)        except CoreException as err:            py_jama_rest_client_logger.error(err)            raise APIException(str(err))    self.__handle_response_status(response)    return response.status_code

But I don't know how I can create the attachment_id then associate my zip file to it.

Thanks for your help !


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>