A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
resource_feedback: 'Required parameter missing or invalid'
const resource_feedback = new ResourceFeedback({ session: session, }); resource_feedback.state = 'requires_action'; resource_feedback.messages = [ 'is not connected. Connect your account to use this sales channel.', ]; resource_feedback.feedback_generated_at = '2022-04-05T17:19:44.396169Z'; const result = await resource_feedback.save({});
Hi @MarkNZL,
With the looks on it, you do not have the session variable. You are talking about a new ResourceFeedback or am I missing some of your code. See how they define the test_session variable here.
import {ResourceFeedback} from '@shopify/shopify-api/dist/rest-resources/2022-04/index.js';
const test_session = await Shopify.Utils.loadCurrentSession(request, response);
const resource_feedback = new ResourceFeedback({session: test_session});
resource_feedback.state = "requires_action";
resource_feedback.messages = [
"is not connected. Connect your account to use this sales channel."
];
resource_feedback.feedback_generated_at = "2022-04-05T17:19:44.396169Z";
await resource_feedback.save({});
Also, try to remove the comma after the session object. Maybe just me, but I always have problems with objects when there is a comma after the last variable
const resource_feedback = new ResourceFeedback({ session: session });
Hi @made4Uo
Thanks for your response.
Yes I'm trying to create a new ResourceFeedback.
My session is fetched earlier and defined just in the variable session, I have debugged and it is set. I tried removing the comma but it made no difference unfortunately.
This is the body that is passed to the endpoint
https://{{SHOP}}.myshopify.com/admin/api/2022-04/resource_feedback.json
{"resource_feedback3":{"api_version":"2022-04","state":"requires_action","messages":["is not connected. Connect your account to use this sales channel."],"feedback_generated_at":"2022-04-05T17:19:44.396169Z"}}
Could it be because the body is resource_feedback3 not resource_feedback?
I can create the resource feedback using CURL.
Content-Length: 209
Content-Type: 'application/json'
X-Shopify-Access-Token: 'XXXXXXXXXXXXXXXXXXXXX'
Thanks,
Mark.
This may be an issue with Shopify Node API library? I've got it working with axios for now.