New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Api v2 #20
Conversation
* update authentication method required for new v2 of the api * add additional required config variables for tap usage * update access_token request to comply with v2 of api * update schemas to reflect data returned from the v2 api * add additional schemas to reflect additional data points available @see https://help.getharvest.com/api-v2/ @see singer-io#9
…a and loops through data, thus removing redundancies * allow each parent object loaded from the `sync_endpoint` to recursively sync additional endpoints (related to the parent object) through a `for_each_handler` * remove api requests from the individual `sync_$item` methods, instead prefer using the generic `sync_endpoint` method
…nc_endpoint` method)
* allow key_properties to be set to anything other than just `["id"]` for use with pivot table style data * update config.json and state.json documentation in README.md * add additional schemas and subsequent loading-code that was missed in the first pass * additional minor fixes such as * incorrect schema attribute names * missing attributes * incorrect schema attribute type/formats * minor formatting tweaks
…ompany, otherwise the user receives a 403 response error * load company metadata from harvest api * ensure specific features are either enabled or disabled before beginning endpoint syncs
* define default key_properties directly in `load_and_write_schema` method signature * update version * fix other minor inconsistencies
Hi @StevenMHernandez, thanks for your contribution! In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. |
You did it @StevenMHernandez! Thank you for signing the Singer Contribution License Agreement. |
This is awesome, @StevenMHernandez!! Thanks for the well thought out, comprehensive updates. We are going to review and test these changes during our next sprint. We'll update soon! |
@nick-mccoy Any update on this? Is there anything I can do on my end to help? |
Hey @StevenMHernandez -- sorry for the delay -- reviewing this is in our current sprint, so we should be getting to it by next week at the latest. |
Cool, no worries and thanks! |
Hi @StevenMHernandez, I'm taking a look at this to see about getting it merged. Right now, I'm having a bit of trouble with the authorization, and I'm not sure what pattern the tap is using when looking at the Harvest docs on auth. It looks to be a mix of personal access token (using Here's the details of what I've done. Personal Access TokenI've tried creating a personal access token using the developer UI and passing it in the config like so (put it in
but this failed the Auth object's access token request with this partial stack trace.
OAuthI created an OAuth app and was able to retrieve a refresh token and access token, and specified them in the config. I also removed the Have you run into these troubles locally? It would be great if the tap could be used with both of these methods. |
It appears that the problem was that I wasn't specifying the In the meantime, if you have any thoughts on the above regarding the auth method, and how this flow should work, I'm interested! |
Sorry for the issues with this. OAuth Yup, I'm not sure if this is an oversight in the design of the harvest API or if I'm missing something. Personal Access Token I hadn't considered this method in this pull request. Do you think this is an additional requirement you all will need to accept this pull request or perhaps something that can be handled independently? |
Actually, it appears the |
Yes, I was just about to comment that! When I query it with Postman and my OAuth token, I get an object like this:
Potentially, this could be requested by the tap to see which account the access token has been granted for. It would make sense to take in both the Personal Access TokenAs for the Personal Access Token method, I was just confused by the Account ID, since that auth method was the only mention of it I could find at the time. OAuth is definitely preferred. |
… from user config
Ok @dmosorast That last commit allows the tap to automatically retrieve the first account_id. |
Great! Thanks for the quick turnaround. It's working on my end now. I'll continue with the review and figure out the plans for merging. All in all, it's looking pretty good. I should have something concrete early next week. |
Sure thing and thanks for taking a look into this! |
@StevenMHernandez I've got everything set up to get this merged and released. If you have a Stitch account, can you PM me in the Singer slack @.dmosora and we can see about getting you set up there for testing? |
This directly handles issue #9.
In addition to the stated issue of API v1 being deprecated by Harvest, this pull request also syncs many new data points that v2 offers (in addition to some data points not available in the previous version).
Indirectly; as a result of this pull request, the following issues will be handled as well:
As a result of moving from API v1 up to v2 for Harvest, there are a few configuration changes that must occur (for use in systems such as Stitch). These
config.json
changes can be seen in the updated READMEaccount_id
is required instead ofaccount_name
user_agent
is required (though it appears that it was required in the past, just not documented)I've changed the version # for the module because it makes large changes to the underlying schemas compared to that of module v1.1.1
active
vsis_active
)Please let me know any questions, concerns or recommendations.