Project API integration

The Codacy API offers specific methods to manipulate repositories. To use these API methods, run local analysis, or send coverage results for your repository, you must use a project API Token generated specifically for your repository. Each project API Token is only valid for one repository.

Learn how to generate an API token, tips, and warnings on our documentation page. If you have any questions, please feel free to reach out to us!

See also

1 Like

Hello @amelia

Thanks for the API Documentation link. I have one particular notification use case and could not find enough info in the doc hence raising the query here.
We have multiple repositories in our project and all of them are using Codacy. We have started pushing Code coverage to Codacy. We are planning to send an email notification through Jenkins with the latest Code Coverage in that. However, I could not find an API to fetch Code Coverage from Codacy. Could you please point me to the documentation link for that.

Thanks in advance.

1 Like

Hello @shailesh-vaidya,

When do you want to send these emails that include the most recent coverage value for each repository? Do you want to do this periodically (for example every day or every week), or perhaps after each commit?

Edit: In the meantime I also share with you the URL for the Codacy API reference, where you may find a couple of endpoints that are useful for your use case: Codacy API

1 Like

Hi @paulo.ribeiro

Thanks for Codacy API reference. We are planning to report code coverage every day for now. I use Codacy API API and able to fetch Code Coverage with recent analysis.

Just curious if we can fetch historical data for coverage maybe like last three coverage details.

1 Like

I understand your use case better now, @shailesh-vaidya.

For historical data, you will want to check out this endpoint:

https://app.codacy.com/api/api-docs#listcommitanalysisstats

You can select the last number of days that you’re interested in (by using a query string ?days=<number>). Although the endpoint skips days without commits, you can always choose to further filter the data on your end based on the received timestamps.

2 Likes

@paulo.ribeiro - Thanks for your help :+1:. I am able to fetch historical data using listcommitanalysisstats API

2 Likes