using bulkOperationRunMutation for productUpdate

Shopify Partner
1 0 1

You can try formatting your code by indenting it with four spaces. Here's your updated content:

I am trying to create bulkOperationRunMutation for updating Shopify products

For this, I am trying to upload the data to the Google Storage bucket so that Shopify can fetch the data from that bucket and run the bulk operation query. In cURL, it is working fine but when I try to send the POST request using Python, it is giving me an error: <Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>Cannot create buckets using a POST.</Details></Error>



url = "https://url_to_bucket/"
    'Content-Type': 'text/jsonl',
    'success_action_status': '201',
    'acl': 'private',
    'key': 'upload_path_on_the_bucket',
    'x-goog-date': '20230404T073135Z',
    'x-goog-credential': 'merchant_credentials',
    'x-goog-algorithm': 'GOOG4-RSA-SHA256',
    'x-goog-signature': 'signature_token',
    'policy': 'policy_token',
    'file': 'file_contant'
headers = {
  'Content-Type': 'multipart/form-data'
response = requests.request("POST", url, headers=headers, data=payload)



cURL Code:



curl --location 'https://url_to_bucket/' \
--header 'Content-Type: multipart/form-data' \
--form 'Content-Type="text/jsonl"' \
--form 'success_action_status="201"' \
--form 'acl="private"' \
--form 'key="upload_path_on_the_bucket"' \
--form 'x-goog-date="20230404T073135Z"' \
--form 'x-goog-credential="merchant_credentials"' \
--form 'x-goog-algorithm="GOOG4-RSA-SHA256"' \
--form 'x-goog-signature="signature_token"' \
--form 'policy="policy_token"' \
--form 'file="file_contant"'



I have tried the documentation of Shopify and Python to make a multipart/form-data request but nothing worked for me.

Can someone help me with this issue? Thank you.

Reply 1 (1)
Shopify Staff
Shopify Staff
1202 190 419

Hi @navneetkmr 👋


One method is to use `urllib3` to form-encode your parameters. Here is an example implementation:


staged_upload =

data = staged_upload.json().get("data")
staged_target = data["stagedUploadsCreate"]["stagedTargets"][0]
target_params = staged_target["parameters"]
signed_url = staged_target["url"]

multipart_formdata = {p["name"]:p["value"] for p in target_params}
multipart_formdata["file"] = (test_filename, open(test_filename, "rb").read())

http = urllib3.PoolManager()
r = http.request(


Hope that helps!


Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit or the Shopify Web Design and Development Blog