API ResourceFeedback "Required parameter missing or invalid"

Hi,
I’m trying to use ResourceFeedback on my sales channel app https://shopify.dev/api/admin-rest/2022-04/resources/resourcefeedback.
But I’m following the NodeJS example exactly and always get the response body

resource_feedback: 'Required parameter missing or invalid'

Am I missing anything obvious here? I have the write_resource_feedbacks scope enabled. I don’t get any errors when I try ResourceFeedback.all({session: session})

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({});

I’ve tried adding the api_version also but still get the same response.
Here’s the ID of a failed request 1a67b97e-8de0-4422-b25c-1ae0a3289a15
I can’t figure what param is missing or invalid.Any help would be greatly appreciated,
Thanks.

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.

And these are the headers

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.