Anchor to commentSpamcomment
comment Spam
mutation
Requires Any of ,
access scopes.
Marks a comment as spam.
Anchor to Arguments
Arguments
- •ID!required
The ID of the comment to be marked as spam.
Was this section helpful?
- Anchor to commentcomment•
The comment that was marked as spam.
- Anchor to userErrorsuser•
Errors [CommentSpam User Error!]!non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation MarkCommentAsSpam($id: ID!) {6 commentSpam(id: $id) {7 comment {8 id9 }10 userErrors {11 field12 message13 }14 }15 }`,16 {17 variables: {18 "id": "gid://shopify/Comment/757536350"19 },20 },21);2223const data = await response.json();24
mutation MarkCommentAsSpam($id: ID!) {
commentSpam(id: $id) {
comment {
id
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation MarkCommentAsSpam($id: ID!) { commentSpam(id: $id) { comment { id } userErrors { field message } } }",
"variables": {
"id": "gid://shopify/Comment/757536350"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation MarkCommentAsSpam($id: ID!) {
commentSpam(id: $id) {
comment {
id
}
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Comment/757536350"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation MarkCommentAsSpam($id: ID!) {
commentSpam(id: $id) {
comment {
id
}
userErrors {
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/Comment/757536350"
},
},
});
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 MarkCommentAsSpam($id: ID!) {
commentSpam(id: $id) {
comment {
id
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/Comment/757536350"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "id": "gid://shopify/Comment/757536350"3}
Response
JSON1{2 "commentSpam": {3 "comment": {4 "id": "gid://shopify/Comment/757536350"5 },6 "userErrors": []7 }8}