How can I access pagesBatch from Azure DevOps?

柔情痞子 提交于 2020-01-16 19:35:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!