# Invalid input JSON error when using search endpoint with (C#) System.Net.Http.HttpClient

**URL:** <https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [January 9, 2023, 4:33pm UTC](https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478 "2023-01-09T16:33:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loiti](https://avatars.discourse-cdn.com/v4/letter/l/8491ac/32.png) [@Loiti](https://community.hubspot.com/u/Loiti)\
**Post date:** [January 9, 2023, 4:33pm UTC](https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478/1 "2023-01-09T16:33:33Z")

</div>

Hi, I am experiencing a weird issue that I cannot reproduce with Postman (it works there).

**Use case**

I have a minimal setup (simplified) following the docs ([Search the CRM - HubSpot docs](https://developers.hubspot.com/docs/api/crm/search)) to pull off a simple search (unfiltered, unsorted) with an empty JSON body and the System.Net.Http.HttpClient. This is the code:

```lia-code-sample
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "MY API TOKEN");

var request = new HttpRequestMessage(HttpMethod.Post, "https://api.hubapi.com/crm/v3/objects/contacts/search");
request.Content = JsonContent.Create("{}");
var response = httpClient.Send(request);
var responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();

```

**Problem**

I am receiving this error all the time:

`{"status":"error","message":"Invalid input JSON on line 1, column 1: Cannot construct instance of `com.hubspot.inbounddb.publicobject.core.v3.search.PublicObjectSearchRequest$Json` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('{}')","correlationId":"8d449ee5-df7f-44f6-93ab-131f255826ee"}`

I have tried various things with the HttpClient, but all ways lead back to this error. I cannot reproduce this error with Postman, it works perfectly there.

Help is much appreciated!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 11, 2023, 6:39pm UTC](https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478/2 "2023-01-11T18:39:56Z")

</div>

Hi, @Loiti 👋 Thanks for reaching out and for including those details. Hey, @MPTatFoodDays @gotmike @RMones, do you have any experience or troubleshooting tips you can share with @Loiti?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![Loiti](https://avatars.discourse-cdn.com/v4/letter/l/8491ac/32.png) [@Loiti](https://community.hubspot.com/u/Loiti)\
**Post date:** [January 24, 2023, 9:02am UTC](https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478/3 "2023-01-24T09:02:54Z")

</div>

Is there no one to help us out?

---

<div class="post-metadata">

**Author:** ![Venkatasai08](https://avatars.discourse-cdn.com/v4/letter/v/bcef8e/32.png) [@Venkatasai08](https://community.hubspot.com/u/Venkatasai08)\
**Post date:** [June 26, 2024, 12:45pm UTC](https://community.hubspot.com/t/invalid-input-json-error-when-using-search-endpoint-with-c-system-net-http-httpclient/72478/4 "2024-06-26T12:45:54Z")

</div>

did you solve this issue
