Skip to Content
Web API: The Good Parts
book

Web API: The Good Parts

by 水野 貴明
November 2014
Intermediate to advanced
224 pages
3h 22m
Japanese
O'Reilly Japan, Inc.
Content preview from Web API: The Good Parts

4章HTTPの仕様を最大限利用する

1章でも述べたように、公開するAPIの仕様や挙動を決定する際の原則の1つとして、既存の標準仕様を遵守することと、デファクトスタンダードはできるかぎり守ることがあげられます。Web APIはHTTP上で通信を行うので、HTTPの仕様をしっかりと理解して、それを活用したほうがより使い勝手がよいものとなります。

4.1 HTTPの仕様を利用する意義

HTTPをはじめとして、インターネット上で利用される仕様の多くはRFC(Request for Comments)と呼ばれる仕様書で定義されています。HTTPはその最新版であるバージョン1.1はRFC 7230†1から始まる一連の文書群で定義されています。RFC 7230は2014年6月に発行された新しいRFCですが、これはHTTPのバージョン1.1の最初のRFCではなく、RFC 2616という1999年に発行されたRFCを更新するものです。RFCはそのルールとして新しく仕様を変更したり追加したりする場合は、新しいRFCを発行して古いものを上書きすることになっているからです。HTTPに関する仕様はこれ以外にも、たとえばPATCHメソッドに関するRFC 5789、新たなステータスコードを追加したRFC 6585などがあります。こうした仕様は全世界に公開されており、HTTPを使った数多くのやりとりの基礎を築いています。ですからWeb APIを設計する上でも、こうした仕様をよく理解することで不本意に独自仕様を入れてしまう危険性が減ります。

標準の仕様をできるかぎり利用して作られたAPIは第三者にとっても、少なくとも独自仕様に比べればずっと理解しやすいはずで、利用時のバグの混入を減らしたり、あなたのAPIが広く使われる、あるいはすでに存在するライブラリやコードが再利用可能になる可能性がずっと高くなります。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Principles of Web API Design: Delivering Value with APIs and Microservices

Principles of Web API Design: Delivering Value with APIs and Microservices

James Higginbotham
API Design Patterns

API Design Patterns

John J. Geewax
Designing APIs with Swagger and OpenAPI

Designing APIs with Swagger and OpenAPI

Lukas Rosenstock, Joshua Ponelat
Mastering API Architecture

Mastering API Architecture

James Gough, Daniel Bryant, Matthew Auburn

Publisher Resources

ISBN: 9784873116860Other