Anchor to bulkProductResourceFeedbackCreatebulk
bulkProductResourceFeedbackCreate
mutation
Requires access scope. Also: App must be configured to use the Storefront API or as a Sales Channel.
Creates product feedback for multiple products.
Anchor to Arguments
Arguments
- Anchor to feedbackInputfeedback•
Input [ProductResource requiredFeedback Input!]! An array of inputs to create the feedback. Limited to 50.
Was this section helpful?
Anchor to BulkProductResourceFeedbackCreatePayload returnsBulkProductResourceFeedbackCreatePayload returns
- Anchor to feedbackfeedback•
The feedback that's created.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Was this section helpful?
- Create a feedback record indicating the product is usable by your app
- Create a new Product ResourceFeedback
- Error response
- bulkProductResourceFeedbackCreate reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation($feedbackInput: [ProductResourceFeedbackInput!]!) {6 bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) {7 userErrors {8 field9 message10 }11 feedback {12 productId13 state14 feedbackGeneratedAt15 productUpdatedAt16 messages17 }18 }19 }`,20 {21 variables: {22 "feedbackInput": {23 "productId": "gid://shopify/Product/172561227",24 "state": "ACCEPTED",25 "feedbackGeneratedAt": "2021-05-01T23:00:00Z",26 "productUpdatedAt": "2021-04-28T16:00:00Z",27 "messages": []28 }29 },30 },31);3233const data = await response.json();34
mutation($feedbackInput: [ProductResourceFeedbackInput!]!) {
bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) {
userErrors {
field
message
}
feedback {
productId
state
feedbackGeneratedAt
productUpdatedAt
messages
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation($feedbackInput: [ProductResourceFeedbackInput!]!) { bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { productId state feedbackGeneratedAt productUpdatedAt messages } } }",
"variables": {
"feedbackInput": {
"productId": "gid://shopify/Product/172561227",
"state": "ACCEPTED",
"feedbackGeneratedAt": "2021-05-01T23:00:00Z",
"productUpdatedAt": "2021-04-28T16:00:00Z",
"messages": []
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation($feedbackInput: [ProductResourceFeedbackInput!]!) {
bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) {
userErrors {
field
message
}
feedback {
productId
state
feedbackGeneratedAt
productUpdatedAt
messages
}
}
}`,
{
variables: {
"feedbackInput": {
"productId": "gid://shopify/Product/172561227",
"state": "ACCEPTED",
"feedbackGeneratedAt": "2021-05-01T23:00:00Z",
"productUpdatedAt": "2021-04-28T16:00:00Z",
"messages": []
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation($feedbackInput: [ProductResourceFeedbackInput!]!) {
bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) {
userErrors {
field
message
}
feedback {
productId
state
feedbackGeneratedAt
productUpdatedAt
messages
}
}
}`,
"variables": {
"feedbackInput": {
"productId": "gid://shopify/Product/172561227",
"state": "ACCEPTED",
"feedbackGeneratedAt": "2021-05-01T23:00:00Z",
"productUpdatedAt": "2021-04-28T16:00:00Z",
"messages": []
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation($feedbackInput: [ProductResourceFeedbackInput!]!) {
bulkProductResourceFeedbackCreate(feedbackInput: $feedbackInput) {
userErrors {
field
message
}
feedback {
productId
state
feedbackGeneratedAt
productUpdatedAt
messages
}
}
}
QUERY
variables = {
"feedbackInput": {
"productId": "gid://shopify/Product/172561227",
"state": "ACCEPTED",
"feedbackGeneratedAt": "2021-05-01T23:00:00Z",
"productUpdatedAt": "2021-04-28T16:00:00Z",
"messages": []
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "feedbackInput": {3 "productId": "gid://shopify/Product/172561227",4 "state": "ACCEPTED",5 "feedbackGeneratedAt": "2021-05-01T23:00:00Z",6 "productUpdatedAt": "2021-04-28T16:00:00Z",7 "messages": []8 }9}
Response
JSON1{2 "bulkProductResourceFeedbackCreate": {3 "userErrors": [],4 "feedback": [5 {6 "productId": "gid://shopify/Product/172561227",7 "state": "ACCEPTED",8 "feedbackGeneratedAt": "2021-05-01T23:00:00Z",9 "productUpdatedAt": "2021-04-28T16:00:00Z",10 "messages": []11 }12 ]13 }14}