How to get TeamCity builds statistics for last quarter(3 month) from API or DB(SQL)? - api

TeamCity issue tracker link https://youtrack.jetbrains.com/issue/TW-50234
I want to calc "builds" latency for last week and compare to avg. last month and avg. last quarter.
last month can be easelly fetch via REST API like so:
https://teamcity/app/rest/builds?locator=buildType:(id:<BUILD_ID>)&fields=count,build(number,status,queuedDate,finishDate)
Latest entrie from payload is 20170502T131511+0300
But how to fetch more data - for last 3 month?
I have access to SQL DB(We use PostgreSQL) and SQL is good solution.

You could come across paginaton of the response: try to include nextHref attribute of the response entity (builds) for items collections (i.e. use &fields=count,nextHref instead of just &fields=count and you'll probably get the link to the second page of the output).
It it is your case, following locator dimensions are available to control the number of the builds in response:
count:<number> - serve only the specified number of builds
start:<number> - list the builds from the list starting from the position specified (zero-based)
lookupLimit:<number> - limit processing to the latest N builds only (the default is 5000). If none of the latest N builds match the other specified criteria of the build locator, 404 response is returned
There should be no limitation of the output based on the date, but in case there're some clean up rules configured, there could be no data, obviously.

Related

Apigee Integration: How to use listEntitiesPageSize parameter in conjunction with the listEntitiesPageToken parameter o navigate through the pages

Good day everyone,
we are trying to have through the use of the integrations of the Apigee service of google all the rows in a bigquery table that have a certain value in a field.
this operation is quite easy to do, but when we have more than 200 lines as a result, problems arise.
The problem is that using the integration to connect to BigQuery I am not returning any listEntitiesPageToken value and not even any listEntitiesNextPageToken value
so i can't figure out how i can go about navigating the result pages
Has anyone had the same problem? What do you suggest?
In the tutorial: "https://cloud.google.com/apigee/docs/api-platform/integration/connectors-task#configure-the-connectors-task" is write : "For example, if you are expecting 1000 records in your result set, you can set the listEntitiesPageSize to 100. So when the Connectors task runs for the first time, it returns the first 100 records, the next 100 records in the second run and so on."
And there is a tip: "Use the listEntitiesPageSize parameter in conjunction with the listEntitiesPageToken parameter to navigate through the pages."
I used the tutorial to understand how to use the task for loop and I understood that I should create a "subintegration" which must be called by a "main integration" for each element present in a list / array.
But what what can i do since these tokens are empty?

Coinbase API v2 Getting Historic Price for Multiple Days

I'm having some trouble with a Coinbase.com API call for historical data.
Previously, I was getting a variable length of days that would match the amount of space available on a terminal screen with a request URL that looked like this:
https://api.coinbase.com/v2/prices/historic?currency=USD&days=76
This would pull the previous 76 days of price history. An example of the old output is here:
https://gist.github.com/KenDB3/f071a06ab3ef1a899d3cd8df8b40a049#file-coinbase-historic-days-example-2017-12-23-json
This stopped working a few days ago. The closest I can get to this is with this request URL (though I don't get the data I want):
https://api.coinbase.com/v2/prices/BTC-USD/historic?days=76
The output from this can be seen here:
https://gist.github.com/KenDB3/f071a06ab3ef1a899d3cd8df8b40a049#file-coinbase-historic-days-example-2018-07-19-json
In the second example, it is just displaying prices from the day of the query at different times of that day. What I really want is the first example output where it gives a single price per day going back as many days as the request is for.
The project this is connected to is here:
https://github.com/KenDB3/SyncBTC
Links that do not work:
https://api.coinbase.com/v2/prices/historic?currency=BTC-USD&days=76
(No Results)
https://api.coinbase.com/v2/prices/BTC-USD/historic?2018-07-15T00:00:00-04:00
(Does not pull data from 7/15/2018)
Any reason you aren't using coinbase pro?
The new api is very easy to use. Simply add the get command you want followed by the parameters separated with a question mark. Here is the new historic rates api documentation:
https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles
The get command with the new api most similar to prices is "candles". It requires three parameters to be identified, start and stop time in iso format and granularity which is in seconds. Here is an example:
https://api.pro.coinbase.com/products/BTC-USD/candles?start=2018-07-10T12:00:00&end=2018-07-15T12:00:00&granularity=900
EDIT: also, note the time zone is not for your time zone, I believe its GMT.
Here is a wrapper for the CoinBase API for the export of Historical Data: https://pypi.org/project/Historic-Crypto/
It should provide the required outcome through invoking:
pip install Historic-Crypto
from Historic_Crypto import HistoricalData
new = HistoricalData('ETH-USD',300,'2020-06-01-00-00').retrieve_data()
for a full list of cryptocurrencies available:
pip install Historic-Crypto
from Historic_Crypto import Cryptocurrencies
data = Cryptocurrencies(extended_output=False).find_crypto_pairs()

Cross-project time-record filtering using Active Collab 5 API

For Active Collab team watching this tag.
I am working on a project that uses new Active Collab 5 API, I am having performance issue trying to run reports.
Example I try to build reports on date-range, and currently to achieve that I need to first run a call to get all projects.
Followed by a loop with this call:
API::get('/projects/'.$id.'/time-records/filtered-by-date?' . http_build_query(['from' => $from, 'to' => $to]))
However we have a large number of projects, in addition to high number of active projects we also need to filter Archived projects as well to get correct reports for billing.
Now I work with around 1500 projects in AC.
So I need to make 1500 API calls which takes a huge performance hit. Is there a way that you can possibly build something that would work along these lines.
API::get(/timerecords/filter-by-date);
with a possible passed parameter that will say (all, active, complited) project state.
Please let me know what you can do or if I have missed something in your documentation that already does this.
Thanks
What you need here is not a request that goes through all projects one by one, but a request that it tailored for cross-project reporting. Active Collab 5 has just the right API endpoint for that - /reports/run.
As an example, you can use this command to query time records and expenses from all active projects that were tracked today:
curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=TrackingFilter&project_filter=active&tracked_on_filter=today"
Notice the route (/reports/run) and query arguments:
type - specify type of the report, in this case time and expense tracking report,
project_filter - specify project filter. Apart from active, other useful values of this filter are completed (for completed projects), selected_1,2,3,4 (selected projects with a list of project ID-s), client_1,2,3,4 (projects for clients with the given ID-s), category_1,2,3,4 (projects in categories with the given ID-s),
tracked_on_filter - filter by the date when records were tracked. To target a particular date use selected_date_YYYY-MM-DD and to target a date range use selected_range_YYYY-MM-DD:YYYY-MM-DD.
tracked_by_filter - filter by who tracked the time. It can have various values, like anybody, logged_user, selected_1,2,3.
To list only time records, set type_filter to time (or to expenses if you want only expenses to be listed).

Counts on the server side via WSAPI?

Is it possible to do object counts on the server side of Rally with the WSAPI?
For example, I've got an app that would like to count the number of unresolved defects for each project in our workspace. I don't need to know anything about those defects themselves, so I just want a count, and don't need any other data pulled back.
Any way to do this?
You might want to check out Alan's helpful answer to this Question:
Rally: Pull stories counts by schedule state for a release?
The analog for Defects would be:
https://rally1.rallydev.com/slm/webservice/1.31/defect.js?query=(State < "Fixed")
It does pull all the data, but you can grab the TotalResultCount attribute that is returned in the response to get the number of Defects matching your query.

Repeated events in Eventbrite API

I noticed that when I search future events via event_search method, sorted by date, that first events in result-set have start date from past. Problem with these events is that they are repeatable events (e.g. weekly), but API does not return events' recurrence type (daily, weekly, monthly, other). Method should at least return next event start date and recurrance type.
Hidden feature:
Add "display=repeat_schedule" to your API requests to reveal a series of start_date, end_date pairs for each repeating instance.
Unfortunately, Eventbrite's "repeating events" feature (available on their website) is not totally compatible with their API services:
Most storage models have an associated identifier or 'handle' to reference each asset or resource. In REST-speak these identifiers are known as 'resource ids'.
Eventbrite's repeating events share a single event id, and they include a string that describes the schedule when they repeat.
The head of the chain of repeating events is returned, with a "repeats" attribute that is set to "yes". And, the "repeat_schedule" attribute should now be present on all repeating events.
The string that is revealed will have a different format depending how the event is configured to repeat:
Daily repeating events:
"daily-4-07/26/2012" - every fourth day, from the date/time of the
start_date until 2012-07-26.
"daily-mf-07/26/2012" - every Monday
through Friday, from the start_date day/time until "2012-07-26"
Weekly repeating events:
"weekly-3-Y,N,N,N,N,N,N-09/16/2012" - every 3rd week, on each day marked with a "Y" until "2012-09-16"
Monthly repeating events:
"monthly-2-10-06/30/2012" - every second month, on the 10th day of the month until "2012-06-30"
"monthly-2-second/sat-06/30/2012" - every second month, on the second Saturday of that month, until "2012-06-30".
Custom repeat schedule (not fully supported):
"custom-3199915" - This format is really rare. Unfortunately, these events can not be easily summarized using a single string.
This bug needs to be fixed by EventBrite
However Would this work has a temp workaround? I would work in some examples I have seen.
I make request for events on March 17, 2012
I get back a past date
<repeats>yes</repeats>
<start_date>2011-12-04 09:30:00</start_date>
<end_date>2011-12-04 10:30:00</end_date>
Can I assume this is a repeating event that occcurs on March 17, 2012
at the same times?
There's a new endpoint that can be used to fetch all the events that are part of a series, the only values required are: OAuth Token and the event_series_id which is the parent event ID or the ID of the event where the series was created.
This is the endpoint:
GET - https://www.eventbriteapi.com/v3/series/{event_series_id}/events/
Replace {event_series_id} with your event series ID.
More details at: https://www.eventbrite.com/platform/api#/reference/event/list/list-events-by-series