I tried to test my graphql API using variable and i got an error as below
my API information:
body:
mutation CreateBroadcast ($item:UpsertBroadcastMessageInput!) {
UpsertBroadcastMessage(item:$item) {
broadcast_message_id
status
title
message
image
icon
product_url
discount_code
sent_at
campaign_name
actions {
title
action
icon
}
}
}
Variable:
{
“item”: {
“campaign_name”: “Ha test API”,
“message”: “A branding new year is coming, 01 2023”,
“status”: “Sent”,
“discount_code”: “A6HL4E”,
“actions”: {
“title”: “Explore”,
“action”: “https://google.com”
},
“sending_option”: “Send”,
“title”: “Ha test API1”,
“product_url”: “google.com”,
“sent_at”: “1679466727000”
}
}
and the error as
{
“errors”:[
{
“message”:“json request body could not be decoded: json: cannot unmarshal string into Go struct field RawParams.variables of type map[string]interface {} body:{\n "query": "mutation CreateBroadcast ($item:UpsertBroadcastMessageInput!) { UpsertBroadcastMessage(item:$item) { broadcast_message_id status title message image icon product_url discount_code sent_at campaign_name actions { title action icon } } }",\n "variables": "{ \"item\": { \"campaign_name\": \"Ha test API\", \"message\": \"A branding new year is coming, 01 2023\", \"status\": \"Sent\", \"discount_code\": \"A6HL4E\", \"actions\": { \"title\": \"Explore\", \"action\": \"https://google.com\" }, \"sending_option\": \"Send\", \"title\": \"Ha test API1\", \"product_url\": \"google.com\", \"sent_at\": \"1679466727000\" } }"\n}”
}],
“data”:null
}
Could you please help to show me how to resolve this error? Thanks so much