pawelmalak / snippet-box

Snippet Box is a simple self-hosted app for organizing your code snippets. It allows you to easily create, edit, browse and manage your snippets in various languages.
MIT License
930 stars 80 forks source link

Feature Request: Search API #27

Closed sbhal closed 2 years ago

sbhal commented 2 years ago

Currently the only way to search for snippets is to launch selfhosted website. Can we have search API to enable faster search for snippets from applications launchers like Alfred for macos?

pawelmalak commented 2 years ago

Try this:

POST http://snippets.domain.com/api/snippets/search
query: String: required
tags: String[]: required
languages: String[]: required

Example body:

{
    "query": "Card",
    "tags": [],
    "languages": []
}

{
    "query": "",
    "tags": ["ui", "react", "vue"],
    "languages": []
}

{
    "query": "",
    "tags": ["automated"],
    "languages": ["bash", "python"]
}
sbhal commented 2 years ago

Thanks @pawelmalak . Above api is working for me.