# bulkDiscountResourceFeedbackCreate - admin - MUTATION Version: unstable ## Description Creates resource feedback for multiple discounts. ### Access Scopes `write_resource_feedbacks` access scope. Also: App must be configured to use the Storefront API or as a Sales Channel. ## Arguments * [feedbackInput](/docs/api/admin/unstable/input-objects/DiscountResourceFeedbackInput): DiscountResourceFeedbackInput! - An array of inputs to create the feedback. Limited to 50. ## Returns * [feedback](/docs/api/admin/unstable/objects/DiscountResourceFeedback): DiscountResourceFeedback The feedback that's created. * [userErrors](/docs/api/admin/unstable/objects/BulkDiscountResourceFeedbackCreateUserError): BulkDiscountResourceFeedbackCreateUserError! The list of errors that occurred from executing the mutation. ## Examples ### Create a feedback record indicating a problem Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }\",\n \"variables\": {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discounts that have a discount code with spaces are not supported.\"\n ]\n },\n {\n \"discountId\": \"gid://shopify/DiscountNode/2429471\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }`,\n \"variables\": {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discounts that have a discount code with spaces are not supported.\"\n ]\n },\n {\n \"discountId\": \"gid://shopify/DiscountNode/2429471\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }\nQUERY\n\nvariables = {\n \"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.\"]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }`,\n {\n variables: {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discounts that have a discount code with spaces are not supported.\"\n ]\n },\n {\n \"discountId\": \"gid://shopify/DiscountNode/2429471\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n}" #### Graphql Input { "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." ] } ] } #### Graphql Response { "data": { "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 Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state feedbackGeneratedAt discountUpdatedAt messages } } }\",\n \"variables\": {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"ACCEPTED\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": []\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }`,\n \"variables\": {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"ACCEPTED\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": []\n }\n ]\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }\nQUERY\n\nvariables = {\n \"feedbackInput\": [{\"discountId\"=>\"gid://shopify/DiscountNode/240556786\", \"state\"=>\"ACCEPTED\", \"feedbackGeneratedAt\"=>\"2021-07-15T23:00:00Z\", \"discountUpdatedAt\"=>\"2021-07-28T16:00:00Z\", \"messages\"=>[]}]\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n }`,\n {\n variables: {\n \"feedbackInput\": [\n {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"ACCEPTED\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": []\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n feedbackGeneratedAt\n discountUpdatedAt\n messages\n }\n }\n}" #### Graphql Input { "feedbackInput": [ { "discountId": "gid://shopify/DiscountNode/240556786", "state": "ACCEPTED", "feedbackGeneratedAt": "2021-07-15T23:00:00Z", "discountUpdatedAt": "2021-07-28T16:00:00Z", "messages": [] } ] } #### Graphql Response { "data": { "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 Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) { bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) { userErrors { field message } feedback { discountId state messages } } }\",\n \"variables\": {\n \"feedbackInput\": {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n messages\n }\n }\n }`,\n \"variables\": {\n \"feedbackInput\": {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n messages\n }\n }\n }\nQUERY\n\nvariables = {\n \"feedbackInput\": {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\"Discount currency must be supported by catalog.\"]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n messages\n }\n }\n }`,\n {\n variables: {\n \"feedbackInput\": {\n \"discountId\": \"gid://shopify/DiscountNode/240556786\",\n \"state\": \"REQUIRES_ACTION\",\n \"feedbackGeneratedAt\": \"2021-07-15T23:00:00Z\",\n \"discountUpdatedAt\": \"2021-07-28T16:00:00Z\",\n \"messages\": [\n \"Discount currency must be supported by catalog.\"\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {\n bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {\n userErrors {\n field\n message\n }\n feedback {\n discountId\n state\n messages\n }\n }\n}" #### Graphql Input { "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." ] } } #### Graphql Response { "data": { "bulkDiscountResourceFeedbackCreate": { "userErrors": [ { "field": [ "feedbackInput", "0", "feedbackGeneratedAt" ], "message": "Feedback for a later version of this resource was already accepted." } ], "feedback": [] } } }