0

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

Laurel
  • 5,965
  • 14
  • 31
  • 57
Yashon Lin
  • 1,845
  • 2
  • 13
  • 10

2 Answers2

2

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": "charlie@example.com"
            },
            "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.

Anantha Raju C
  • 1,780
  • 12
  • 25
  • 35
0

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