'GitLab Rest API set GitLab Pages visibility to 'Everyone'

I have a program that allows me to automatically create a new GitLab project with the GitLab API and I would like to be able via this API to set the visibility of Pages to 'Everyone', which defaults to 'Only project members'. I looked in the doc but I couldn't find anything about the Pages visibility setting. If anyone has an idea I would be interested in reading it.

Thank you



Solution 1:[1]

There's an attribute in the Create Project API to change the Pages visibility level. The attribute is called pages_access_level and the available options are disabled, private, enabled, or public. Using the option public should set the access level so Everyone can access your Page.

The pages_access_level attribute also exists when modifying a Project from the API.

Here's the docs for the Create Project API where you can see the pages_access_level attribute.

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 Adam Marshall