具有curl的Visual Studio Team Services REST API [英] Visual Studio Team Services REST API with curl

查看:104
本文介绍了具有curl的Visual Studio Team Services REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用Google的DHC扩展程序或代码访问Team Services API,但使用curl无法实现相同的功能.

I can access Team Services API with Google's DHC Extension or in code but can't achieve the same with curl.

到目前为止,我已经尝试过:

so far I've tried:

curl -H授权:承载MY_ACCESS_TOKEN" https://MYINSTANCE.VisualStudio.com/DefaultCollection/_apis/projects?api-version = 2.0

curl -H "Authorization: Bearer MY_ACCESS_TOKEN" https://MYINSTANCE.VisualStudio.com/DefaultCollection/_apis/projects?api-version=2.0

我不断收到对象移至...."的结果.

i'm keep getting "Object moved to ...." result.

我该如何解决?

推荐答案

我之前遇到过此问题,可以通过将" Bearer "更改为" Basic "来使其正常工作.

I met this issue before and get it work by changing "Bearer" to "Basic".

curl -H "Authorization: Basic <TOKEN>" https://xxxxxx.VisualStudio.com/DefaultCollection/_apis/projects?api-version=2.0

更新:当前,VSO Rest API仅支持基本身份验证和OAuth 2.0授权访问.您可以使用基本身份验证,也可以使用curl从VSO获取OAuth2.0访问令牌.请参阅此链接以获取详细信息:使用OAuth 2.0授权对REST API的访问.

Update: Current, VSO Rest API only support Basic authentication and Authorize access with OAuth 2.0. You'd either use Basic Auth or use curl to fetch OAuth2.0 access token from VSO. Refer to this link for details: Authorize access to REST APIs with OAuth 2.0.

我刚刚使用个人访问令牌尝试了DHC,但收到以下消息:很抱歉,Chrome API不允许获取用于重定向的响应正文."因此,您可能需要清除浏览器的cookie和缓存,然后尝试查看承载者是否可以与DHC中的VSO Rest API一起使用.

And I just tried DHC with personal access token, but get following message: "We are sorry, but Chrome API does not allow to get a response body for redirect." So you may need to clear your browser cookies and caches and then try to see if bearer can works with VSO Rest API in DHC.

这篇关于具有curl的Visual Studio Team Services REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆