Snippets API: search endpoint
Release notes
There is no efficient way to find a text string in your snippets through the Snippets API. I propose exposing a GET /snippets/search endpoint to solve this.
Problem to solve
Currently the only way to search for a text string via the API is to request GET /snippets and search through all the snippets in the response. This is inefficient since you're always getting the full list of snippets even if only one snippet contains the matching text.
Intended users
Developers who use the Snippets API and want to return a list of snippets containing a particular text.
User experience goal
The experience should be similar to retrieving all snippets or a single snippet. The response should have the same JSON data structure as GET /snippets.
Proposal
The GET /snippets/search endpoint can accept two parameters:
query = <keywords>-
match = [all|any|exact](defaults toall)
Further details
Examples
Retrieve snippets containing both "HTML" and "CSS":
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/snippets/search?query=html+css"
Retrieve snippets containing either "Windows" or "Mac":
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/snippets/search?query=windows+mac&match=any"
Retrieve snippets containing the exact phrase "git commands":
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/snippets/search?query=git+commands&match=exact"
Permissions and Security
Unknown
Documentation
Unknown
Availability & Testing
Unknown
Available Tier
All tiers
What does success look like, and how can we measure that?
Unknown
What is the type of buyer?
Unknown
Is this a cross-stage feature?
Unknown