1
GET請求正常工作。BaseCamp API使用承載令牌授權標頭在PUT和POST上禁止使用
我使用omniauth-大本營和RESTClient實現:
resource = RestClient::Resource.new(
'https://basecamp.com/27xxxxx/api/v1',
headers: {
user_agent: 'MyApp ([email protected]',
authorization: "Bearer #{my_token}",
content_type: "application/json"
}
)
resource['/projects/7213xxx/todos/129851xxx.json'].get # => 200 OK
resource['/projects/7213xxx/todos/129851xxx.json'].put(content: 'Hello!') # => 403 FORBIDDEN