# Product Insert API getting Error Bad Request

**URL:** <https://community.hubspot.com/t/product-insert-api-getting-error-bad-request/11638>\
**Category:** APIs & Integrations\
**Created:** [November 8, 2018, 4:03am UTC](https://community.hubspot.com/t/product-insert-api-getting-error-bad-request/11638 "2018-11-08T04:03:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 8, 2018, 4:03am UTC](https://community.hubspot.com/t/product-insert-api-getting-error-bad-request/11638/1 "2018-11-08T04:03:07Z")

</div>

Hello everyone  
i am new in hubsport . and i am try to call product api for insert data. But every time i call the api i am getting error like

{“status”:“error”,“message”:“Invalid input JSON on line 1, column 1: Can not deserialize instance of java.util.ArrayList out of START\_OBJECT token”,“correlationId”:“b8c01b31-73a1-4885-8ee8-6266d49a48c4”,“requestId”:“a60e40b17d0768d626985e20e7ef5cbd”}

and my code like

int Retval = 0;  
StringBuilder SB = new StringBuilder();

```auto
 var security = SecurityInfoHubSpot.Instance;
 List<HSProduct> products = new List<HSProduct>();

 var stringPayload = JsonConvert.SerializeObject(model);

 SB.Append("[{\"name\": \"name\",\"value\": \"" + model.name + "\"},");
 SB.Append("{\"name\": \"description\",\"value\": \"" + model.description.Replace("\"", "\\\"") + "\"},");
 SB.Append("{\"name\": \"price\",\"value\": \"" + model.price + "\"},");
 SB.Append("{\"name\": \"recurringbillingfrequency\",\"value\": \"quarterly\"}");
 SB.Append("]");

 string baseURL = Helper.HubSpotBaseUrl + resourcePath ;
 string reqParam = String.Format("?hapikey={0}", security.HAPIKey);

 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls |
 SecurityProtocolType.Tls11 |
 SecurityProtocolType.Tls12;
 ServicePointManager.MaxServicePointIdleTime = 1000;

 using (HttpClient client = new HttpClient())
 {

 client.DefaultRequestHeaders.Clear();
 client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

 try
 {

 var response = await client.PostAsJsonAsync(baseURL + reqParam, model);

 if (response.IsSuccessStatusCode && response.StatusCode != HttpStatusCode.NoContent)
 {
 Retval = 1;
 }
 else
 {
 var errtext = response.Content.ReadAsStringAsync();
 }
 }
 catch (Exception ex)
 {

 throw;
 }
 }

 return await Task.FromResult(Retval);

```

}

and my json is

[{“name”: “name”,“value”: “[Sample] 1 L Le Parfait Jar”},{“name”: “description”,“value”: "

When removes for a thorough cleaning. May be frozen - just be sure to leave enough room for expansion.

"},{“name”: “price”,“value”: “9.9500”},{“name”: “recurringbillingfrequency”,“value”: “quarterly”}]

please help me

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 12, 2018, 4:09pm UTC](https://community.hubspot.com/t/product-insert-api-getting-error-bad-request/11638/2 "2018-11-12T16:09:33Z")

</div>

Hi [@brajalal.mahanty](https://community.hubspot.com/u/brajalal.mahanty) happy to help here! Are you using this endpoint to create products in HubSpot? [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/methods/products/create-product). If so, it looks like you’re using an API key rather than OAuth 2.0, is this correct?

Along with answering my questions above, can you reply to this thread with the following:

1. The Request URL including the method and headers (Make sure Content Type is set to application/json)
2. The raw body you’re sending to HubSpot.
3. Your HubSpot Account ID (also known as HubID or Portal ID).

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [November 30, 2018, 11:11am UTC](https://community.hubspot.com/t/product-insert-api-getting-error-bad-request/11638/3 "2018-11-30T11:11:30Z")

</div>

Now my problem is solve. Problem is in the json body
