wpsharks / wp-kb-articles

KB Articles for WordPress; adds a new Custom Post Type.
http://wpkbarticles.com/
2 stars 1 forks source link

Tag Search API for External Tools #105

Closed jaswrks closed 9 years ago

jaswrks commented 9 years ago

It would be very helpful if WPKBA's API supported tag queries. In short, making it possible to search through all existing KB article tags. With that in place, we could build Alfred Workflows that search KB tags whenever we write new articles.

raamdev commented 9 years ago

:+1: Love this idea!

jaswrks commented 9 years ago

Endpoint: /wp-kb-articles/api/tax-query

Query args:

Example response:

{
    "results": [
        {
            "id": "16",
            "name": "[s2File /] Shortcode",
            "slug": "s2file",
            "url": "http://s2member.com/kb/kb-tag/s2file/",
            "description": "",
            "parent_id": "0",
            "count": "4"
        },
        {
            "id": "78",
            "name": "[s2Get /] Shortcode",
            "slug": "s2get",
            "url": "http://s2member.com/kb/kb-tag/s2get/",
            "description": "",
            "parent_id": "0",
            "count": "1"
        },
        {
            "id": "80",
            "name": "[s2If /] Shortcode",
            "slug": "s2if",
            "url": "http://s2member.com/kb/kb-tag/s2if/",
            "description": "",
            "parent_id": "0",
            "count": "2"
        },
        {
            "id": "37",
            "name": "[s2Member-List /] Shortcode",
            "slug": "s2member-list",
            "url": "http://s2member.com/kb/kb-tag/s2member-list/",
            "description": "",
            "parent_id": "0",
            "count": "5"
        },
        {
            "id": "77",
            "name": "[s2MOP /] Shortcode",
            "slug": "s2mop",
            "url": "http://s2member.com/kb/kb-tag/s2mop/",
            "description": "",
            "parent_id": "0",
            "count": "3"
        },
        {
            "id": "17",
            "name": "[s2Stream /] Shortcode",
            "slug": "s2stream",
            "url": "http://s2member.com/kb/kb-tag/s2stream/",
            "description": "",
            "parent_id": "0",
            "count": "8"
        },
        {
            "id": "18",
            "name": "Shortcodes",
            "slug": "shortcodes",
            "url": "http://s2member.com/kb/kb-tag/shortcodes/",
            "description": "",
            "parent_id": "0",
            "count": "20"
        }
    ],
    "args": {
        "type": "tag",
        "q": "shortcode",
        "expand": true
    }
}
raamdev commented 9 years ago

@jaswsinc Awesome! I've started a KB Article draft to document this: https://github.com/websharks/wp-kb-articles-kb/issues/10

jaswrks commented 9 years ago

@raamdev writes...

I've started a KB Article draft to document this: websharks/wp-kb-articles-kb#10

Ah, thanks.


I added four new workflows here for tag-related searches: https://github.com/jaswsinc/alfred-workflows/tree/master/websharks

Type: s2ts [query] to search for tag slug insertions. Type: s2tl [query] to search for tag link insertions.

Same with zcts and zctl.

jaswrks commented 9 years ago

Note that your very first search for tags will take just a moment. After this, tag searches are instantaneous autocompletions.

raamdev commented 9 years ago

instantaneous autocompletions.

I did notice how amazingly fast it was--awesome!