--- title: bulkDiscountResourceFeedbackCreate - GraphQL Admin description: Creates resource feedback for multiple discounts. api_version: unstable api_name: admin source_url: html: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/bulkDiscountResourceFeedbackCreate md: >- https://shopify.dev/docs/api/admin-graphql/unstable/mutations/bulkDiscountResourceFeedbackCreate.md --- # bulk​Discount​Resource​Feedback​Create mutation Requires `write_resource_feedbacks` access scope. Also: App must be configured to use the Storefront API or as a Sales Channel. Creates resource feedback for multiple discounts. ## Arguments * feedback​Input [\[Discount​Resource​Feedback​Input!\]!](https://shopify.dev/docs/api/admin-graphql/unstable/input-objects/DiscountResourceFeedbackInput) required An array of inputs to create the feedback. Limited to 50. *** ## Bulk​Discount​Resource​Feedback​Create​Payload returns * feedback [\[Discount​Resource​Feedback!\]](https://shopify.dev/docs/api/admin-graphql/unstable/objects/DiscountResourceFeedback) The feedback that's created. * user​Errors [\[Bulk​Discount​Resource​Feedback​Create​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/unstable/objects/BulkDiscountResourceFeedbackCreateUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a feedback record indicating a problem #### Query ```graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } } ``` #### Variables ```json { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }", "variables": { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }`, { variables: { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby 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: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } } QUERY variables = { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }`, "variables": { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }' \ --variables \ '{ "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] }' ``` #### Response ```json { "bulkDiscountResourceFeedbackCreate": { "userErrors": [], "feedback": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discounts that have a discount code with spaces are not supported." ] }, { "discountId": "gid://shopify/DiscountNode/2429471", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } ] } } ``` * ### Create a feedback record indicating the discount is usable by your app #### Description Indicates that the app does not have any outstanding issues with this discount. #### Query ```graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } } ``` #### Variables ```json { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }", "variables": { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }`, { variables: { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby 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: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } } QUERY variables = { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }`, "variables": { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }' \ --variables \ '{ "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] }' ``` #### Response ```json { "bulkDiscountResourceFeedbackCreate": { "userErrors": [], "feedback": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] } } ``` * ### Error response #### Description Sending outdated feedback (previous feedback payload has a greater resource\_updated\_at value) returns an error #### Query ```graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } } ``` #### Variables ```json { "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } }", "variables": { "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } }`, { variables: { "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby 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: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } } QUERY variables = { "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } }`, "variables": { "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } }' \ --variables \ '{ "feedbackInput": { "discountId": "gid://shopify/DiscountNode/240556786", "state": "REQUIRES_ACTION", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [ "Discount currency must be supported by catalog." ] } }' ``` #### Response ```json { "bulkDiscountResourceFeedbackCreate": { "userErrors": [ { "field": [ "feedbackInput", "0", "feedbackGeneratedAt" ], "message": "Feedback for a later version of this resource was already accepted." } ], "feedback": [] } } ``` * ### bulkDiscountResourceFeedbackCreate reference