bulkOperationRunMutation gives Unexpected file structure - expected JSONL

GrantDB
Explorer
57 2 10

I have been following the documentation here: https://shopify.dev/api/usage/bulk-operations/imports#generate-the-uploaded-url-and-parameters

Yet when I run bulkOperationRunMutation to run the import I get 

{u'bulkOperationRunMutation': {u'bulkOperation': None, u'userErrors': [{u'field': None, u'message': u'Unexpected file structure - expected JSONL'}]}}

I used the example file

I use this to add the file and it is successfully added

r = requests.post(self.endpoint, files=self.multipart_form_data, headers={
'X-Shopify-Access-Token': self.shopify_access_token
})

I get a response like this 

<?xml version="1.0" encoding="UTF-8"?>
<PostResponse><Location>https://shopify.s3.amazonaws.com/tmpSTUFFSTUFF</Location><Bucket>shopify</Bucket><Key>STUFFSTUFF"</ETag></PostResponse>

 

Then this to run it

r = requests.post(self.endpoint, json={'query': query}, headers={
'X-Shopify-Access-Token': self.shopify_access_token,
'X-GraphQL-Cost-Include-Fields': self.shopify_include_cost_fields
})

I am using all the data from the example, what am I missing?

Thanks

Grant

Reply 1 (1)
GrantDB
Explorer
57 2 10

I think have this sorted

I was using this

self.multipart_form_data["file"] = '/servicecatalogue/development/import/products.jsonl'

But should be this I think

self.multipart_form_data["file"] = open('/servicecatalogue/development/import/products.jsonl', 'rb')

Thanks

Grant