Post request to artifacts/generate returns no multipart boundary param in Content-Type'

Hi All,

I’ve been trying to upload a file using the /api/management/v1/deployments/artifacts/generate endpoint, however it returns the following error:

{'error': 'no multipart boundary param in Content-Type', 'request_id': 'd915bbaf-78bc-4a08-a9de-a7752a3f4309'}

when running the following python code using requests and I’m not sure what could be causing it. Any suggestions or ideas would be appreciated. Thanks

        self.post_headers = {
            'Content-Type': 'multipart/form-data',
            'Accept': 'application/json',
            'Authorization': self.authorization
        }

        with open("/home/user/workspace/deploy/deploy/demo.txt", "rb") as f:
            deb_file = f.read()

        print(deb_file)

        payload = {
            'name': "test",
            'description': "test",
            'device_types_compatible': ["test"],
            'type': "single_file",
            'args': "string",
            'file': deb_file
        }

        r = requests.post('https://hosted.mender.io/api/management/v1/deployments/artifacts/generate',
                          data=payload, headers=self.post_headers)

Hi @sowmr,

Thanks for reaching out. Just guessing (and googling): have you tried this? Error when POST file multipart/form-data · Issue #505 · github/fetch · GitHub

Greetz,
Josef