Hi
I want to upload images via url and I used the api productImageAppend for it.
But getting following error:
[ { line: 1, column: 30 } ]
[ { path: [], explanation: 'Expected value to not be null' } ]
{
errors: [
{
message: 'Variable $input of type ProductAppendImagesInput! was provided invalid value',
locations: [Array],
extensions: [Object]
}
]
}
What is wrong with my input?
Passed data:
{
id: 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzYxNjY4OTIwMTk4ODI=',
images: [
{
id: 'gid://shopify/ProductImage/23275841716394',
src: 'https://75b4f01e4a04.ngrok.io/aintelligence/current/6166892019882/6166892019882_23275841716394.jpg'
},
{
id: 'gid://shopify/ProductImage/23275841749162',
src: 'https://75b4f01e4a04.ngrok.io/aintelligence/current/6166892019882/6166892019882_23275841749162.jpg'
}
]
}
GraphQl
const APPEND_IMAGES = `mutation productAppendImages($input: ProductAppendImagesInput!) {
productAppendImages(input: $input) {
newImages {
id
}
product {
id
}
userErrors {
field
message
}
}
}
`
Function appendImages
async function appendImages(queryName, variables, token) {
try {
const res = await axios({
headers: {
'X-Shopify-Access-Token': token,
},
method: 'post',
data: {
query: queryName,
variables: variables,
},
url: url,
});
if (res) {
console.log(res.data.errors[0].locations)
console.log(res.data.errors[0].extensions.problems)
console.log(res.data)
return res;
}
} catch (err) {
console.log(err.message);
}
}
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |