How to get all commits in GitHub? - java

I'm using GitHub API to get Commits.
GET /repos/:owner/:repo/commits
https://api.github.com/repos/nasa/mct/commits?branch=incoming&since=2014-08-26T23:43:48Z
For example, owner:nasa project:mct
I want to get all commits in branch:incoming and since that time.But it seems only returns one commit(should be 9 commits).What can I do?

I've got it.I should check Github API more carefully.
You can use pagination to get what you want.
By default,It only displays the default number of items.

Related

Google place API key

So my question is.. I have created a map activity & I am using the google place API key for requests to find locations on the map.
I have took the basic structure of the search function & I am trying to use it in order to get results.. but I have 2 problems with this.
1. My API key is limited to 1 search per day.. cant understand why.
2. when I am running a search with it I always get zero results.. also don't know why.
Can some one please help me with this issue ?
Thx.
Nimrod
Below, is my search line :
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input="+Uri.encode(query)+"&inputtype=textquery&fields=photos,formatted_address,name&key="+apiKey
New pricing changes went into effect on July 16, 2018. For more information, check out the Guide for Existing Users.
Please check for more info:https://developers.google.com/places/web-service/usage-and-billing

Dropbox API ListFolder limit 2000 entries

I found this out recently that the listFolder/Continue API returns 2000 entries only. And I have also tried recursion and while loops to fetch all the metadata and add to a existing top level result.getEntries() list. But none of these approaches are working, I still see that only 2000 metadata entries are in the ultimate result.
Has anyone tried and made it work in Java?
Each page of listFolder results, i.e., each response from a single call to listFolder or listFolderContinue, can contain up to about 2,000 entries. (Note that this number is not guaranteed, so you should not rely on it.)
To make sure you can get all of the items in a folder, you need to use both listFolder and listFolderContinue, calling back to listFolderContinue with the latest cursor when the hasMore on the last call was true. There's a working example here:
https://github.com/dropbox/dropbox-sdk-java/blob/c6aeb4bf3011e6b803eaa325ea20a52f8412ee0f/examples/tutorial/src/main/java/com/dropbox/core/examples/tutorial/Main.java#L32

How to get the Google's search result using Java

According to the answer in here, using Gson we can programmatically achieve to retrieve the result that Google will return to a query. Nonetheless, yet there are 2 questions are remaining in my mind:
How can we do similar thing for Bing?
How can we get more than 4 results based on the referred answer? Because the results.getResponseData().getResults().get(n).getUrl() for n>4 returns exception.
As #Niklas noted, google search api is deprecated, thus you should not use it for your project. Currently the only solution would be to get search result by http request to get a html search results and than parse it yourself.
In case of Bing, there is a search API, but it has a limited number of calls for free users. If you need to make a lot of requests, than you will have to pay for it. https://datamarket.azure.com/dataset/5BA839F1-12CE-4CCE-BF57-A49D98D29A44

How to get all commits for a certain release in GitHub?

I know I can get all commits in a project using GET /repos/:owner/:repo/commits
Now I want to get all commits for a certain release of that project.
What should I do?
Judging by your answer to my question, you want the commits made since some tag. This will take a couple steps to complete, first you need to get the SHA for the tag in question. You'll want to use the git references API to get a specific reference. In the specific example that you linked you'll want to do
GET /repos/nasa/mct/git/refs/tags/v1.8b3
And you'll want to get the 'sha' attribute from the object stored in the 'object' attribute of the response object. With the 'sha' attribute, you'll want to use the commits API to list commits starting with that 'sha' so your request will look like this:
GET /repos/nasa/mct/commits?sha=%(sha_from_first_request)s
That will give you 30 commits per-page by default (if I remember correctly), so you should see if adding &per_page=100 to the end helps. I can't tell you exactly how to do this in Java, but I expect you'll be able to use one of the libraries written to interact with the API to make it easier.

Notify when web content change

Im new to java and working on a simple application that monitor an url and notify me when a table is updated whit new items. Looking at the entire page will not work as there are commercials that change all the time and they would give false positives.
My thought was to fetch the url line by line looking for the elements. For each element I will check to see if the element is already in an arraylist. If not the element is added to the arraylist and a notification is send.
What I need support with is not the exact code but advice if this would be a good approach and if I should store the elements in an array list or if I should use a file instead as there are 2 lines of text in each element.
Also It would be good to get recomandation on what methods and libs there would be good to look at.
Thanks in advance
Sebastian
To check the site it'd probably be more stable to parse the HTML and work with an object representation of the DOM. I've never had to do this but in a question regarding how to do this another user suggested using JTidy, maybe you could have a look at that.
As for storing the information (what you currently do in your ArrayList): this really depends on what you use your application for. If you only want to be notified of changes that occur during the runtime of your program this is perfectly fine. If you want to have the information persist you should find a way to store the information in the file system or database.

Categories

Resources