问题
This works fine
curl -vsu ":${pat}" -XGET \
"https://dev.azure.com/${organization}/${project}/_apis/wiki/wikis/${project}.wiki/pages/20/stats?api-version=6.0-preview.1&pageViewsForDays=3"
but the following gives me an HTTP 401 - using the same personal access token:
curl -vsu ":${pat}" -d '{"top":5}' -XPOST \
"https://dev.azure.com/${organization}/${project}/_apis/wiki/wikis/${project}.wiki/pagesBatch?api-version=6.0-preview.1"
Here are specs for the former and for the latter.
I am admin of the project in question, so this should not be a permission problem, I suppose. So what am I doing wrong?
回答1:
A 401 error response indicates that proper authorization was not provided, so base on the error, you can try to create a new PAT with the scope selected as full access
and try again.
I tested this rest api with postman , it works fine. You can also test in postman to see if the problem only occurs when using curl.
来源:https://stackoverflow.com/questions/59441649/how-can-i-access-pagesbatch-from-azure-devops