Properly use API pagination for "License Compliance"
With https://gitlab.com/gitlab-org/gitlab-ee/issues/10059 we have implemented pagination on the Frontend. We need to user proper pagination by the backend though to allow for more than 100 licenses.
Implementation Plan
To create licenses
uri = URI('https://gitlab.com/api/v4/projects/<project id>/managed_licenses')
req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
req['PRIVATE-TOKEN'] = '<token>'
(1.100).each do |x|
payload = { approval_status: 'approved', name: "BSD#{x}" }.to_json
req.body = payload
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(req)
end
sleep 1
p res
end
- We have to either work with Kaminari or config to change maximum
per_page
Edited by Can Eldem