Yashon Lin
Yashon Lin

Reputation: 1935

Get git commit info by dates with stash rest api

Is there a way to get git commits info by dates with stash rest API?

I have searched developer documentation, and learned that you could get commits info with commit id and so on, but not with date.

https://developer.atlassian.com/stash/docs/latest/reference/rest-api.html

Upvotes: 1

Views: 6520

Answers (2)

Irina Sanikovich
Irina Sanikovich

Reputation: 1

Searching for commits in Bitbucket Server and DC can still be challenging. However, you can do the following:

Upvotes: 0

Anantha Raju C
Anantha Raju C

Reputation: 1907

As per the reference document for the Atlassian Stash REST API.

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits 

can be used to retrieve a page of changesets from a given starting commit or between two commits. The commits may be identified by branch or tag name or by hash. A path may be supplied to restrict the returned changesets to only those which affect that path

Sample response

{
    "size": 1,
    "limit": 25,
    "isLastPage": true,
    "values": [
        {
            "id": "def0123abcdef4567abcdef8987abcdef6543abc",
            "displayId": "def0123",
            "author": {
                "name": "charlie",
                "emailAddress": "[email protected]"
            },
            "authorTimestamp": 1377738985925,
            "message": "More work on feature 1",
            "parents": [
                {
                    "id": "abcdef0123abcdef4567abcdef8987abcdef6543",
                    "displayId": "abcdef0"
                }
            ]
        }
    ],
    "start": 0,
    "filter": null,
    "authorCount": 1,
    "totalCount": 1
}

You could use authorTimestamp to achieve your goal.

Upvotes: 3

Related Questions