biostar-central icon indicating copy to clipboard operation
biostar-central copied to clipboard

API for tags has issues

Open RamRS opened this issue 1 year ago • 0 comments

I see two issues with the API for tags. One is minor/cosmetic and the other seems to be major.

MINOR: Documentation on API page is problematic:

API page screenshot

See the code segment under "Given" (the URL to the right). It shows a localhost URL which should be changed to https://www.biostars.org/api.... Also, the path to the tags.txt file specified is on Natay's Desktop, which should be masked/redacted. Third, the API doc says there's a parameter called months but the code block shows trange, not months. Fourth, showing the contents of tags.txt might be helpful.

MAJOR: The tags API does not work as advertised. The months parameter is useless and the trange parameter shown doesn't seem to acknowledge any value either. See demo below:

$ cat tags.txt
bash
R

$ curl -X POST -F "tags=@${PWD}/tags.txt" https://www.biostars.org/api/tags/list/\?trange=year
{
    "bash": {
        "answer_count": 61,
        "comment_count": 75,
        "total": 91
    },
    "r": {
        "answer_count": 502,
        "comment_count": 678,
        "total": 926
    }
}

$ curl -X POST -F "tags=@${PWD}/tags.txt" https://www.biostars.org/api/tags/list/\?months=1
{
    "bash": {
        "answer_count": 61,
        "comment_count": 75,
        "total": 91
    },
    "r": {
        "answer_count": 502,
        "comment_count": 678,
        "total": 926
    }
}

$ curl -X POST -F "tags=@${PWD}/tags.txt" https://www.biostars.org/api/tags/list/\?trange=day
{
    "bash": {
        "answer_count": 61,
        "comment_count": 75,
        "total": 91
    },
    "r": {
        "answer_count": 502,
        "comment_count": 678,
        "total": 926
    }
}

$ curl -X POST -F "tags=@${PWD}/tags.txt" https://www.biostars.org/api/tags/list/\?trange=month
{
    "bash": {
        "answer_count": 61,
        "comment_count": 75,
        "total": 91
    },
    "r": {
        "answer_count": 502,
        "comment_count": 678,
        "total": 926
    }
}

The counts do not change, so the parameter is either not checked or not used.

RamRS avatar Mar 23 '23 16:03 RamRS