Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

前提 業務でAPIの知識を身につける機会があったので、基本的な知識をまとめてみました。 目的 APIの知識がほとんどないような初心者でもAPIが作れるようになること。そのために、今回は以下のフローでAPIを作成するための知識を身につけていきます。 流れ Grapeを使ったRailsのAPIの書き方 Grapeの導入方法 RailsにおけるAPIとは HTTPメソッド APIのURI設計(エンドポイント設計) まとめ Grapeを使ったRailsのAPIの書き方 今回は、こちらのサイトに書いてあるAPIコードをもとに説明をしていこうと思います。 参考: http://dev.classmethod.jp/server-side/ruby-on-rails/ruby-on-rails_create_grape_web-api/ module Twitter class API < Grape:
GET /oauth/authorize/:code(.:format) doorkeeper/authorizations#show oauth_authorization GET /oauth/authorize(.:format) doorkeeper/authorizations#new POST /oauth/authorize(.:format) doorkeeper/authorizations#create PATCH /oauth/authorize(.:format) doorkeeper/authorizations#update PUT /oauth/authorize(.:format) doorkeeper/authorizations#update DELETE /oauth/authorize(.:format) doorkeeper/authorizati
ここ一年ほど Python でバックエンドエンジニアやってます。自分の勉強も兼ねて、デモ用 API を Ruby on Rails で作成 したので、その時の実装と参考にした記事をまとめます。 間違った内容を記述してしまうことがあるかもしれません。その際はコメント欄やツイッターなどで指摘していただけると助かります。 対象 Ruby on Rails で作成したアプリに API の実装を考えている方。 主に Grape と Devise という gem を使って API に認証機能を作成する方法について紹介します。 Ruby on Rails の環境構築や、フレームワークのメリット、API の仕組みなどについては紹介しません。 余談: 実装する背景と選択肢 Rails は API を提供するのみで、残りはすべてクライアントに委譲する、というのが目的です。 フロントエンドは AngularJS
$ cd api_sample $ tree -d |-- app | |-- assets | | `-- images | |-- controllers | | `-- concerns | |-- mailers | `-- models | `-- concerns |-- bin |-- config | |-- environments | |-- initializers | `-- locales |-- db |-- lib | |-- assets | `-- tasks |-- log |-- public `-- test |-- controllers |-- fixtures |-- helpers |-- integration |-- mailers `-- models $ rails-api g scaffold person name:string
$ bin/rails g scaffold user name:string mail:string password:string invoke active_record create db/migrate/20151214145437_create_users.rb create app/models/user.rb invoke test_unit create test/models/user_test.rb create test/fixtures/users.yml invoke api_resource_route route resources :users, except: [:new, :edit] invoke scaffold_controller create app/controllers/users_controller.rb invoke test_un
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く