Discussing APIs and development related to customers, discounts, and order management.
Hi there, I try to create Draft Order from frontend via Admin API. When I use Postman everything is OK, but when I try to create order from frontend always returns 301 fetch/Redirect.
Can anybody help me with this pain 😄
This is my function:
function apiCall() {
return fetch('https://myapp.myshopify.com/admin/api/2021-04/draft_orders.json', {
'method': 'POST',
'headers': {
'X-Shopify-Access-Token': "TOKEN",
'Content-Type': 'application/json'
},
'body': JSON.stringify({
"draft_order": {
"line_items": [{
"variant_id": 99999999999,
"quantity": 1
}]
}
})
})
}
I found solution, the answer is to pass password for Access Token, not the API key