Error Product Insert - StatusCode: BadRequest- Required parameter missing

Topic summary

Issue: Creating a product via Shopify Admin REST API (endpoint /admin/api/2021-10/products.json) using RestSharp returned 400 Bad Request with “{“errors”:{“product”:“Required parameter missing or invalid”}}”.

Context: Private app credentials with Products Read/Write access were used, content-type set to application/json. The initial payload was built as a raw string without proper JSON formatting (unquoted keys/values and incorrect structure around the product object).

Root cause: Malformed JSON body. Shopify expects a top-level “product” object with all keys and string values in double quotes.

Fix: Send a valid JSON payload, for example:

  • Without image: product object containing at least “title” and “body_html” with double-quoted keys/values.
  • With image: include an “images” array of objects with a “src” URL, alongside “title” and “body_html”.
    Also ensure the private app has Products Read/Write permissions.

Outcome: After correcting the JSON format, product creation succeeded.

Status: Resolved.

Summarized with AI on February 25. AI used: gpt-5.

Hi,

I am trying to make a request to add a product using RestSharp and I am getting error Badrequest

“{"errors":{"product":"Required parameter missing or invalid"}}”

I have set Admin API permission [Read/Write] for Products on store settings

also Webhook Version matches with request

{X-Request-ID=6ea097eb-7668-467e-81cc-98a74a910151}

Here is my code ..Please provide some help. Am I missing something in JSON data?

var client = new RestClient(“https://bmswave.myshopify.com/”);
client.Authenticator = new HttpBasicAuthenticator(“xxx”, “xxx”);
https://bmswave.myshopify.com/admin/apps/private
string resource = “/admin/api/2021-10/products.json”;

var requestres = new RestRequest(resource, Method.POST);
StringBuilder postData = new StringBuilder();

postData.Append(“product:{”);
postData.Append(“title:Gloves Small Blk”);
postData.Append(“,”);
postData.Append(“body_html:Gloves Small Blk”);
postData.Append(“,”);
postData.Append(“vendor:BARTON INC”);
postData.Append(“,”);
postData.Append(“product_type:Dressing”);
postData.Append(“}”);

requestres.Method = Method.POST;
requestres.AddJsonBody(postData);
requestres.Parameters.Clear();
requestres.AddHeader(“content-type”, “application/json”);

var response = client.Execute(requestres);

So I figured it out with trial and error. Json format was wrong.

You need to add all values in double quotes

Of course you also have to make sure your private app has Read/Write rights for Product ..in Private App settings.

WITH IMAGE

body = @“{ ““product””:{ ““title””:”“” + title +
@“”" , ““images””:[{““src””:““https://[www.learningcontainer.com](http://www.learningcontainer.com)/wp-content/uploads/2020/07/Sample-JPEG-Image-File-Download-scaled.jpg””}]"
@" , ““body_html””:“”" + body_html +
@“”" }} ";

WITHOUT IMAGE

body = @“{ ““product””:{ ““title””:”“Test1234"” , ““body_html””:"“test ProductJan122022545"” }} ";