Hello,
Previous API 1.0 returns something like this in "files" JSON array:
{ "size": 6, "path": "README.md", "timestamp": "2019-01-11T14:07:48Z", "utctimestamp": "2019-01-11 14:07:48+00:00", "revision": "05b5e8deb387" }
But API 2.0 returns another JSON without any datetime or timestamp info.
How can I migrate my current logic based on API 1.0 what needs this timestamp info?
Hi Stephen,
Thanks for your attention. My endpoint in question is /2.0/repositories/{username}/{repo_slug}/src/{node}/{path} in case of directory listing. I've found out that there is a 'fields' query param what can be used to reveal values.commit.date field. It looks to be what I'm looking for.
I'm sorry if it's out of topic, but I would like to ask how to get list of all possible fields in such case? I've tried '?fields=*' as docs say but it doesn't work for me. I'm looking for file 'revision' field provided by API 1.0 and actively used in my logic. I can find this via additional requests per file to /filehistory/ endpoint but it looks like non-optimal and less performance way.
Maybe there is a guide how to migrate existing logic from API 1.0 to API 2.0?
Hello again Ihor,
Glad you found a resolution to your issue.
When using the "?fields=value", you must name the fields you're wanting to pull. For the endpoint you're using, you may find all of the available fields at /2.0/repositories/{username}/{repo_slug}/src/{node}/{path}.
As far as migration from 1.0 to 2.0, we have some articles which discuss the changes and why. You may find said articles at:
I hope the above allows for an easier transition over to the 2.0 version of the API.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephen,
Thanks, but I cannot find answer how to get "revision" field as it was in 1.0 without additional requests.
Is it possible with API 2.0? Maybe I'm missing some part of api docs about this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again Ihor,
It seems revision has been removed from the above endpoint. You will have to run an additional request to have the revision returned from the following:
Path |
Methods |
If you would like to see revision brought back into the API endpoints, you are welcome to open a feature request within Bitbucket to have this added. You may submit your feature request at https://bitbucket.org/site/master/issues/new.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ihor and welcome to the Community!
I will be very happy to figure out what has happened to the timestamp within an API response. To better help figure out exactly where you're seeing this we need a bit more information. Which REST API endpoint are you accessing?
We check and filehistory does still have a timestamp (date) within the response. Here is the API endpoint for filehistory: /2.0/repositories/{username}/{repo_slug}/filehistory/{node}/{path}
Once we have the endpoint you're using, we will look into this.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.