'How to get version_id of page in wiki with Gitlab API

With Gitlab API it is currently possible to get a specific page of the wiki, and to edit it.

With UI, when you click on a page, you can view its history and see various truncated commit hash depending on version. Is it possible to get these hash with API? Can't find anything in documentation.

Thanks!



Solution 1:[1]

It's not possible using API. The solution I used was to use the fact that the wiki is a git repo. So I cloned the wiki repo and got last relevant commit ID with git log -n1 --format="%H" My-page.md

Solution 2:[2]

Wiki API is there to access the wiki at its current state. Other than that you can use Projects API to see wiki events:

https GET "https://gitlab.url/api/v4/projects/123456/events?target_type=wiki" "PRIVATE-TOKEN: your_private_token"

where gitlab.url is your GitLab instance URL, 123456 is the project ID and your_private_token is your private token

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ticoincoin
Solution 2 Lukasz Korbasiewicz