APIs & Integrations

JeanAMOROS
Participant

Search for a customer by their code (developper C#)

Hello, I am unable to search for a client by one of their properties. I'm developing in c # Here is my code from an example from the HubSpot site.

 

var xclient = new RestClient("https://api.hubapi.com/crm/v3/objects/companies/search?hapikey=" + Extension_HubSpot.Identification_HubSpot);
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"filterGroups\":[{\"filters\":[{\"value\":\"CL000012\",\"propertyName\":\"code-tiers\",\"operator\":\"EQ\"}]}],\"limit\":0,\"after\":0}", ParameterType.RequestBody);
IRestResponse response = xclient.Execute(request);

 

Here is the feedback I have

"StatusCode: BadRequest, Content-Type: application/json;charset=utf-8, Content-Length: 123)"

Can you help me.
best regards

0 Upvotes
3 Replies 3
MichaelC
Guide | Partner
Guide | Partner

Search for a customer by their code (developper C#)

@JeanAMOROS @natsumimori 

 

Here is my screenshot of a confirmed working code in php. It seemes like the difference is the sorts parameter. 

Try adding sorts and see if it works.

 screenshot.jpg



Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

JeanAMOROS
Participant

Search for a customer by their code (developper C#)

Thank you for your reply.
I will try
best regards

natsumimori
Community Manager
Community Manager

Search for a customer by their code (developper C#)

Thanks for sharing your question in the Community @JeanAMOROS !

 

@MichaelC and @RMones , is this topic something you're familiar with? It'd be great if you could share your advice for @JeanAMOROS 😀

0 Upvotes