Anchor to discountResourceFeedbackdiscount
discountResourceFeedback
query
Requires access scope. Also: App must be configured to use the Storefront API or as a Sales Channel.
Returns the discount resource feedback for the currently authenticated app.
Anchor to Arguments
Arguments
- •ID!required
The discount associated with the resource feedback.
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to DiscountResourceFeedbackDiscount•
Resource Feedback Reports the status of discount for a Sales Channel or Storefront API. This might include why a discount is not available in a Sales Channel and how a merchant might fix this.
Was this section helpful?
- Get a discount resource feedback record by ID
- Get a discount resource feedback record by ID that doesn't exist
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
discountResourceFeedback(id: "gid://shopify/DiscountNode/240556786") {
feedbackGeneratedAt
messages
discountId
discountUpdatedAt
state
}
}`,
);
const data = await response.json();
query {
discountResourceFeedback(id: "gid://shopify/DiscountNode/240556786") {
feedbackGeneratedAt
messages
discountId
discountUpdatedAt
state
}
}
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": "query { discountResourceFeedback(id: \"gid://shopify/DiscountNode/240556786\") { feedbackGeneratedAt messages discountId discountUpdatedAt state } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
discountResourceFeedback(id: "gid://shopify/DiscountNode/240556786") {
feedbackGeneratedAt
messages
discountId
discountUpdatedAt
state
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
discountResourceFeedback(id: "gid://shopify/DiscountNode/240556786") {
feedbackGeneratedAt
messages
discountId
discountUpdatedAt
state
}
}`,
});
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
query {
discountResourceFeedback(id: "gid://shopify/DiscountNode/240556786") {
feedbackGeneratedAt
messages
discountId
discountUpdatedAt
state
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"discountResourceFeedback": {
"feedbackGeneratedAt": "2024-09-12T01:10:56Z",
"messages": [
"Discount feedback example message."
],
"discountId": "gid://shopify/DiscountNode/240556786",
"discountUpdatedAt": "2024-09-12T01:10:56Z",
"state": "REQUIRES_ACTION"
}
}