Anchor to bulkDiscountResourceFeedbackCreatebulk
bulkDiscountResourceFeedbackCreate
mutation
Requires access scope. Also: App must be configured to use the Storefront API or as a Sales Channel.
Creates resource feedback for multiple discounts.
Anchor to Arguments
Arguments
- Anchor to feedbackInputfeedback•
Input An array of inputs to create the feedback. Limited to 50.
Was this section helpful?
Anchor to BulkDiscountResourceFeedbackCreatePayload returnsBulkDiscountResourceFeedbackCreatePayload 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 a problem
- Create a feedback record indicating the discount is usable by your app
- Error response
- bulkDiscountResourceFeedbackCreate reference
Examples
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",
mutation($feedbackInput: [DiscountResourceFeedbackInput!]!) {
bulkDiscountResourceFeedbackCreate(feedbackInput: $feedbackInput) {
userErrors {
field
message
}
feedback {
discountId
state
feedbackGeneratedAt
discountUpdatedAt
messages
}
}
}
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."
]
}
]
}
}'
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 data = await response.json();
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."
]
}
]
},
},
});
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)
Input 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."
]
}
]
}
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."