Development discussions around Shopify APIs
Hello,
I do a "bulkOperationRunQuery" mutation to get a lot of data
Is there a way to use fetch to get the JSONL file present in the url of data.currentBulkOperation.url
I have this error "Failed CORS Request" when i set "cors" in fetch option and response.ok false when i set it to "no-cors"
async function handleMutation () {
let mutation = await getOrders({})
let JsonlUrl = data.currentBulkOperation.url
const headers = new Headers({
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
})
let fetchOptions = { method: 'GET',
headers: headers,
mode: 'cors'
}
fetch(JsonlUrl, fetchOptions).then(response =>{
if (response.ok) {
console.log(response.text())
} else {
console.log(response)
}
}).catch(error => {
console.warn('error : ' + error.message)
})
}
thanks for your help
Anyone can help me on this?
the generated url is in this form
https://storage.googleapis.com/shopify-tiers-assets-prod-us-east1/[...]&response-content-disposition=attachment%3B+filename%3D%22bulk-208308535382.jsonl%22%3B+filename%2A%3DUTF-8%27%27bulk-208308535382.jsonl&response-content-type=application%2Fjsonl. Raison : échec de la requête CORS.
I want to fetch the response-content-disposition filename programatically and parse it.
So i finally succeeded, to get the file with server side.
I created a route with Koa, and get my file downloaded on my nodejs server and return the response in my client side.
I’m stuck in the same problem! How did you download the returned URL?
thanks 🙂
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023