Getting data from Organization's API


#1

Can I access my organization's data through the API using the dev account I signed up for with my company's email address? I currently have access to my company's data when logging into the HS site. Does the main HS account for my company need to grant access to the app ID I created when I registered for my dev account? Or is there more on the company side that's needed? I'm attempting to access this data in a Python script to throw into a database. Thanks in advance for your help.


#3

Welcome, @Bryant_Clark!

To clarify, are you trying to access your production account's data with the app you created in the developer account?

If so, you're correct that an admin or super admin in your company's production account will have to connect your OAuth app.

Alternatively, you could also use the API key from your production account to access the data.


#4

Hi @Isaac_Takushi . Thanks a ton for the response. Yes, I'm trying to connect to my company's production account data using the app I created as a developer. I was trying to stay away using my company's api key so I don't take up any of our storage limit.

Do you have a quick set of instructions for my admin connecting my app? Mind you my "app" is just a python script that connects to the API and pulls data. I was looking through the Integrations section of my company's HS settings but there is a long list of options, none of which are as generic as python or a simple HS app.

Apologies for the newb questions. And thanks again for such a quick response.


#5

Thanks for the context, @Bryant_Clark.

If you're working with a simple Python script, using the account's API key will be by far your simplest bet.

If you don't want to consume any of your production account's 40,000 daily API calls, you'll have to use OAuth. This will require more legwork on your part.

The OAuth 2 Quickstart Guide will probably be the best thing to read first, but I'll also try to lay it out in layman's terms below.

  1. If you've already created an app in your developer account, then you can build an authorization URL with the app's client_id, scopes, and a desired redirect_uri.
  2. Once you have this authorization URL, your admin can grant access by following the steps outlined in the first and second screenshots in this article.
  3. You will then use the code parameter value from the redirect URI to generate access and refresh tokens with this endpoint.
  4. Once you get your first access token, you can start using it to authenticate calls instead of an API key. Keep in mind, though, that access tokens expire after 6 hours. If you don't want to manually call this endpoint, you should set up automation on your end to refresh the token every 6 hours.