我正在尝试使用Basecamp Classic API(http://developer.37signals.com/basecamp/comments.shtml).当前的basecamp-wrapper版本给了我适合,其中一个原因是因为json响应包括分页输出,而xml响应包括分页输出.这是一个简单的解决方案,但问题是网址结构不规范.
API指定了一些类似的东西,这使我相信它只是分离出元素路径和集合路径.
Run Code Online (Sandbox Code Playgroud)Get recent comments (for a commentable resource) GET /#{resource}/#{resource_id}/comments.xml Update comment PUT /comments/#{id}.xml
我已经做了几次尝试,并没有真正成功.尝试处理这样的注释充其量只是hacky,并且实际上并不起作用,因为element_path与collection_path不同.
class Resource < ActiveResource::Base
self.site = "https://XXXX.basecamphq.com"
self.user = "XXXX"
self.password = "X" # This is just X according to the API, I have also read nil works
self.format = :xml # json responses include pagination crap
# Override element path so it isn't nested
class << self
def element_path(id, prefix_options={}, query_options={})
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
"#{collection_name}/#{URI.parser.escape id.to_s}.#{format.extension}#{query_string(query_options)}" …Run Code Online (Sandbox Code Playgroud) 我正在为我的iOS basecamp客户端应用程序使用新的Basecamp API.我希望用户能够注销并切换帐户.但我不能因为每次请求授权时都会使用存储在浏览器缓存中的帐户凭据.我想我需要刷新浏览器缓存来执行此操作.如何清除浏览器缓存?
我正在尝试为Basecamp创建一个应用程序.我设法使用curl连接和提取数据(使用cURL和PHP的Basecamp API).但是,这需要用户登录数据.
我想在https://github.com/37signals/api/blob/master/sections/authentication.md中使用OAuth2和Basecamp .不幸的是,有关于此的0文档,我找不到任何示例代码.我看到有几个OAuth2库http://oauth.net/code/,但我不知道如何处理它们.
有人可以告诉我一些php示例代码,我将如何在php中使用OAuth2验证用户,而不是向Basecamp API发出请求?
非常感谢你提前.
这是我第一次涉足 OAuth,所以如果我离基地很远,或者走向完全错误的方向,请耐心等待。
我想编写一个脚本来从 basecamp 3 中提取信息,对其进行格式化,然后通过电子邮件发送。我已经用 basecamp 2 做到了这一点,而且效果很好。但是 basecamp 3 不允许简单的身份验证。这只是一个每周通过 cron 运行一次的脚本。
我发现的大多数 OAuth 示例都需要获取授权 url、在浏览器中访问它、授予授权等以获取访问令牌。请告诉我有一种自动化的方式!我不能让这成为一个手动过程。
我用 requests-oauthlib 尝试了后端应用程序流(在这里找到:https ://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow )
我几乎没有运气就直接尝试了他们的例子:
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
ktclient_id = r'my-client-id'
ktclient_secret = r'my-client-secret'
ktredirect_uri = r'http://www.company.com/whatever'
client = BackendApplicationClient(client_id=ktclient_id)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url=r'https://launchpad.37signals.com/authorization/token',
client_id=ktclient_id,
client_secret=ktclient_secret)
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
Traceback (most recent call last):
File "./get-token.py", line 20, in <module>
client_secret=ktclient_secret)
File "/home/mwilson/.local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 244, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/home/mwilson/.local/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 409, in parse_request_body_response …Run Code Online (Sandbox Code Playgroud) 我是basecamp api的新手,在尝试最简单的例子时:
curl -u user:pass -H 'User-Agent: MyApp (yourname@example.com)' https://basecamp.com/999999999/api/v1/projects.json
Run Code Online (Sandbox Code Playgroud)
我得到错误说:
There's no Basecamp account at this address. Sign in to Launchpad to see your accounts.
Run Code Online (Sandbox Code Playgroud)
我用我的basecamp电子邮件地址替换了用户,并将密码作为密码替换.我输错了什么?
提前致谢!
我将Trix编辑器gem添加到我的Rails 4应用程序中,并严格按照该页面上的说明进行操作.保存帖子后,文本显示正确(粗体/斜体/删除线/段落间距都很好),但是当我保存帖子时,我拖入文本编辑器的任何图像都会消失.我究竟做错了什么?
谢谢.
应用程序/资产/样式表/ application.scss:
/*
*= require_self
*= require trix
*/
@import "bootstrap";
@import "bootstrap-sprockets";
@import "font-awesome";
@import url(https://fonts.googleapis.com/css?family=Delius+Swash+Caps);
@import url(https://fonts.googleapis.com/css?family=Reenie+Beanie);
@import url(https://fonts.googleapis.com/css?family=Special+Elite);
@import url(https://fonts.googleapis.com/css?family=Londrina+Shadow);
Run Code Online (Sandbox Code Playgroud)
应用程序/资产/ Java脚本/ application.js中:
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require bootstrap
//= require trix
//= require_tree .
Run Code Online (Sandbox Code Playgroud)
_form.html.erb:
<%= form_for @article, html: {multipart: true} do |f| %>
<p>
<%= f.label :image %>
<%= f.file_field :image %>
</p>
<p>
<%= f.label :title %>
<%= f.text_field :title %>
</p>
<p> …Run Code Online (Sandbox Code Playgroud) 我在使用DotNetOpenAuth使用OAuth2为Basecamp API工作时遇到了一些困难,这是我到目前为止所做的,这是一个ASP.NET MVC 4 Web应用程序.
public ActionResult Basecamp()
{
var server = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription();
server.AuthorizationEndpoint = new Uri("https://launchpad.37signals.com/authorization/new");
server.TokenEndpoint = new Uri("https://launchpad.37signals.com/authorization/token");
var client = new DotNetOpenAuth.OAuth2.WebServerClient(
server, "my-basecamp-id", "my-basecamp-secret");
client.RequestUserAuthorization(returnTo: new Uri("http://localhost:55321/settings/basecampauth"));
Response.End();
return null;
}
[HttpPost]
public ActionResult BasecampAuth()
{
var server = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription();
server.AuthorizationEndpoint = new Uri("https://launchpad.37signals.com/authorization/new");
server.TokenEndpoint = new Uri("https://launchpad.37signals.com/authorization/token");
var client = new DotNetOpenAuth.OAuth2.WebServerClient(
server, "my-basecamp-id", "my-basecamp-secret");
var state = client.ProcessUserAuthorization(Request);
Response.Write(state.AccessToken);
Response.End();
return null;
}
Run Code Online (Sandbox Code Playgroud)
这是我从Basecamp得到的错误:
---
:error: "Unsupported type: nil. We support …Run Code Online (Sandbox Code Playgroud) 我正在尝试向我们公司的Basecamp信息申请我们正在建设的内部项目.我理解如何在ASP.NET环境中添加凭据,但我是iPad开发的新手,似乎无法从Basecamp获得适当的响应.这是我正在做的事情:
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://mybasecampname.basecamphq.com/projects.xml"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0 ];
Run Code Online (Sandbox Code Playgroud)
我正在添加Bsaecamp所需的HTTP标头,如下所示:
[theRequest setValue:@"application/xml" forHTTPHeaderField:@"Content-Type" ];
[theRequest setValue:@"application/xml" forHTTPHeaderField:@"Accept" ];
Run Code Online (Sandbox Code Playgroud)
我知道我还需要发送我的凭据用于身份验证 - 我的身份验证令牌和我喜欢的任何密码,但我不确定最好的方法.这是我正在尝试的:
NSURLCredential *credential = [NSURLCredential credentialWithUser:@"MY TOKEN HERE"
password:@"x"
persistence:NSURLCredentialPersistenceForSession];
Run Code Online (Sandbox Code Playgroud)
我的问题是:我在这里是正确的轨道还是我完全错过了什么?
这是Basecamp API详细信息的链接,它解释了它需要什么:http://developer.37signals.com/basecamp/
帮助赞赏.
乔
basecamp ×8
api ×3
ios ×2
asp.net-mvc ×1
c# ×1
ipad ×1
iphone ×1
javascript ×1
oauth-2.0 ×1
oauth2 ×1
objective-c ×1
php ×1
python ×1
wysiwyg ×1