New API client libraries available

Highlighted
HubSpot Employee

What’s happening?

We're excited to share the release of a new set of client libraries for PHP, Node.js and Ruby supporting the recently released v3 APIs!

These client libraries allow you to interact with the HubSpot API more easily. They also provide a number of utility functions such as attaching authentication to your requests, handling HubSpot’s rate limits and automatically retrying 500 errors. 

 

These new libraries now meet support for any v3 API currently available in Developer Preview. As new APIs and features are released, we will continue to update the functionality of new client libraries to keep our open source efforts aligned with our latest platform efforts.

 

What’s changing?

This is a brand new set of resources. Previously, the PHP, Node.js and Ruby client libraries were entirely built and supported by members of the HubSpot open source community. Working with these community members, to bring these libraries into HubSpot’s collective open source efforts, the latest version of these APIs are being built with the Open API spec in mind. These updates will allow us to use tooling like the codegen library to keep these libraries up to date with the latest version of the underlying APIs. 

 

This is a part of our mission to enable and empower the community with accessible, low-friction tools and resources in order to have a delightful experience building on the HubSpot platform.

 

When is this happening?

These libraries are now available to download from the various package managers or directly from github: PHP, Node.js and Ruby

 

Please let us know if you have any questions or feedback by joining the conversation here

 

6 Replies 6
Highlighted
Regular Contributor

It's very cool to have an official and up to date ruby gem!

 

But this really looks like it will be very hard to use and debug…

 

module Hubspot
  module Client
    module Crm
      module Contacts
        module Models
          class BatchInputSimplePublicObjectBatchInput

Source

 

It all seems very complex and I didn't see any written test.

I hope it will get better, but if you keep using autogenerated code, I guess I'll continue to use and participate in https://github.com/lounna-team/hubspot-api-ruby.

 

Have a nice day!

 

Reply
0 Upvotes
Highlighted
HubSpot Employee

Hi @fonji ,

 

Thanks for taking to take a look at the new library. While we will keep using autogenerated code for the base of the client, that doesn't mean we can't change things. What would you prefer to see?  Would you propose it match the patterns in the library you lined where there is a class per object?  As we work with different types of objects, is an additonal level of abstraction OK? For example should Contacts and Pages be top level clases or should be nested inside of CRM and CMS respectively?

Really appreciate you taking the time to leave some feedback.

Thanks,
Zack

Reply
0 Upvotes
Highlighted
Regular Contributor

Thanks for your concern @zwolfson! I didn't think you could do such changes. This is good news.

 

> For example should Contacts and Pages be top level clases or should be nested inside of CRM and CMS respectively?

 

I would be fine with any of those: Hubspot::CRM::Contact or Hubspot::Contact.

But I think Client is useless for example, as we won't have a Server Smiley Very Happy

Also in the example above, BatchInput is a prefix and a suffix, which is very weird.

 

In the example on github :

Hubspot::Client::Crm::Objects::Api::AssociationsApi

Api is both a module and a suffix, I don't think we need both. Also API doesn't provide much to the user, same thing for "Objects". And the plural form is surprising.

I would suggest

Hubspot::[Crm::]Association

 With class-level methods (other languages call them "static") so I don't need to create an instance if I just want to associate two objects.

 

Hope this helps, have a nice day!

Highlighted
Regular Contributor

Out of interest how does the rate limit work with these libaries ? 

Reply
0 Upvotes
Highlighted
HubSpot Employee

Hey @ralphioooo,

 

Good question. Rate limiting is built in to the libraries for the standard limit (100 requests/10 seconds). You can optionally turn this off or change the limits it works with. 

 

Happy to answer any more questions you might have about a specific implementatiton.

 

Thanks,
Zack

Reply
0 Upvotes
Highlighted
Esteemed Contributor | Gold Partner

@zwolfson ever since a few days our api-integration which has worked for over a year has stopped working.. I'm convinced something changed server side hubspot.

 

can you please have look :

https://community.hubspot.com/t5/APIs-Integrations/API-auth-Bad-Request-error/m-p/328539#M31770

Reply
0 Upvotes