APIs & Integrations

KevinL33
Member

Search for Companies by Domain returns Method Not Allowed

SOLVE

HI all, I'm trying to use the function Search For Companies by domain, documented here:

https://legacydocs.hubspot.com/docs/methods/companies/search_companies_by_domain

 

But I always receive:

HTTP Error 405 

Method Not Allowed.

 

Has the function been deprecated? If so is there a current replacement for it?

 

Kevin.

0 Upvotes
1 Accepted solution
dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

Search for Companies by Domain returns Method Not Allowed

SOLVE

ah, 

That would be expected then.

2 problems:

1.  you need to use your hapikey to get results specific for your portal

2.  the browser can only make get requests where this endpoint requires a post request. 

You can download postman or an equivalent to test this.

View solution in original post

0 Upvotes
7 Replies 7
KevinL33
Member

Search for Companies by Domain returns Method Not Allowed

SOLVE

Hi @dennisedson I post the url from the demo, or I can put in one of our client contact domains with my apikey and get the same result

 

https://api.hubapi.com/companies/v2/domains/hubspot.com/companies?hapikey=demo


0 Upvotes
KevinL33
Member

Search for Companies by Domain returns Method Not Allowed

SOLVE

I should mention that I'm entering the url on a web browser and just viewing the Json that's returned ( if it's returned).

 

0 Upvotes
dennisedson
Solution
HubSpot Product Team
HubSpot Product Team

Search for Companies by Domain returns Method Not Allowed

SOLVE

ah, 

That would be expected then.

2 problems:

1.  you need to use your hapikey to get results specific for your portal

2.  the browser can only make get requests where this endpoint requires a post request. 

You can download postman or an equivalent to test this.

0 Upvotes
KevinL33
Member

Search for Companies by Domain returns Method Not Allowed

SOLVE

Thanks for the info @dennisedson .  I actually installed the c# package HubSpot.NET and used the functions api.Company.GetByDomain() and api.Company.GetById().  Both work like a charm. Thanks again.  KL.

KevinL33
Member

Search for Companies by Domain returns Method Not Allowed

SOLVE

Hi @Teun   I am using an API key, the demo example doesn't even work.  If you follow my link and copy/paste the example URL you'll see the same error.

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Search for Companies by Domain returns Method Not Allowed

SOLVE

@KevinL33 ,

I just tested in postman and it works for me 🤔

Can you post exactly what you are sending? (minus your hapikey)

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Search for Companies by Domain returns Method Not Allowed

SOLVE

Hi @KevinL33 ,

 

Do you use oAuth2 or the API key? If you use oAuth2, check if you have the correct scopes (contacts) in place. 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.