from WEB+DB PRESS 82
 1回分使うよ! 
 第3章まとめ終わらず。
 リソースの定義の考え方 
 JSON Schema 
 もう少しJSON Schemaを調べてみたよ 
 よーしパパJSON Schema使ってみるぞ
Domain API 
• 「送信元ドメイン」を入れたり出したりするAPIをつくろう!
フィールド名名称データ型 
domain ドメイン名string 
states 状態object 
states.setup セットアップ済みフ 
ラグ 
boolean 
states.available 利用可能フラグboolean 
created リソースの作成日string 
updated リソースの更新日string 
“states” : “10” (== セットアップ=true & 利用可能=false) 
みたいに表現できなくもないけど使いづらい。 
別のオブジェクトにしておけばそれぞれ更新可能 
{ 
“domain” : “mail.example.com”, 
“states” : { 
“setup” : true, 
“available” : true 
}, 
“created” : “2014-06-01T20:12:50”, 
“updated” : “2014-06-01T20:23:16” 
}
 ちゃんと見なさい! 特に英語が苦手なあなた。 
 OpenSocial 
 http://opensocial.github.io/spec/2.5.1/Social-Data.xml#Person 
 schema.org 
 http://schema.org/ 
 Activity Streams 
 https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md
フィールド名名称データ型 
domain ドメイン名string 
states 状態object 
states.setup セットアップ済みフ 
ラグ 
boolean 
states.available 利用可能フラグboolean 
created リソースの作成日string 
updated リソースの更新日string 
※写すのメンドイんでP29参照。 
title -> 何語でもご自由にの模様。 
この段階だとフォーマットが全然定義さ 
れていないので、 
日付型などフリーダム! 
※ちなみに 
Jsonに存在するデータ型は4種類の 
primitive typesと2種類のstructured 
typesのみ。 
strings, numbers, booleans, and null 
objects and arrays 
http://www.ietf.org/rfc/rfc4627.txt
 P30 
 domain -> “maxLength” : 255, “format” : “hostname” 
 States -> “default” 
 二重にdefaultが定義されてますね。 
 Created / update -> “format” : “date-time”
 P30 
 domain -> “maxLength” : 255, “format” : “hostname” 
 States -> “default” 
 二重にdefaultが定義されてますね。 
 Created / update -> “format” : “date-time” 
誰だよお 
前!?
 http://json-schema.org/ 
 Docs -> schema validation -> 7. Semantic validation with "format“ 
 7.3.1. date-time 
 7.3.2. email 
 7.3.3. hostname 
 7.3.4. ipv4 
 7.3.5. ipv6 
 7.3.6. uri
 http://json-schema.org/examples.html 
 a simple example 
 Requiredは最後にまとめて書くらしい 
 “uniqueItems” すげーイイ! ※xsdにもある模様: http://www.w3schools.com/schema/el_unique.asp 
 "warehouseLocation": { 
"description": "Coordinates of the warehouse with the product", 
"$ref": http://json-schema.org/geo 
} 
 → http://json-schema.org/documentation.html -> Standard schemas 
 Geographic Coordinate 
 Card 
 Calendar 
 Address
来週?

Web API デザインの鉄則 第2章

  • 1.
  • 2.
     1回分使うよ! 第3章まとめ終わらず。
  • 3.
     リソースの定義の考え方 JSON Schema  もう少しJSON Schemaを調べてみたよ  よーしパパJSON Schema使ってみるぞ
  • 4.
    Domain API •「送信元ドメイン」を入れたり出したりするAPIをつくろう!
  • 5.
    フィールド名名称データ型 domain ドメイン名string states 状態object states.setup セットアップ済みフ ラグ boolean states.available 利用可能フラグboolean created リソースの作成日string updated リソースの更新日string “states” : “10” (== セットアップ=true & 利用可能=false) みたいに表現できなくもないけど使いづらい。 別のオブジェクトにしておけばそれぞれ更新可能 { “domain” : “mail.example.com”, “states” : { “setup” : true, “available” : true }, “created” : “2014-06-01T20:12:50”, “updated” : “2014-06-01T20:23:16” }
  • 6.
     ちゃんと見なさい! 特に英語が苦手なあなた。  OpenSocial  http://opensocial.github.io/spec/2.5.1/Social-Data.xml#Person  schema.org  http://schema.org/  Activity Streams  https://github.com/activitystreams/activity-schema/blob/master/activity-schema.md
  • 7.
    フィールド名名称データ型 domain ドメイン名string states 状態object states.setup セットアップ済みフ ラグ boolean states.available 利用可能フラグboolean created リソースの作成日string updated リソースの更新日string ※写すのメンドイんでP29参照。 title -> 何語でもご自由にの模様。 この段階だとフォーマットが全然定義さ れていないので、 日付型などフリーダム! ※ちなみに Jsonに存在するデータ型は4種類の primitive typesと2種類のstructured typesのみ。 strings, numbers, booleans, and null objects and arrays http://www.ietf.org/rfc/rfc4627.txt
  • 8.
     P30 domain -> “maxLength” : 255, “format” : “hostname”  States -> “default”  二重にdefaultが定義されてますね。  Created / update -> “format” : “date-time”
  • 9.
     P30 domain -> “maxLength” : 255, “format” : “hostname”  States -> “default”  二重にdefaultが定義されてますね。  Created / update -> “format” : “date-time” 誰だよお 前!?
  • 10.
     http://json-schema.org/ Docs -> schema validation -> 7. Semantic validation with "format“  7.3.1. date-time  7.3.2. email  7.3.3. hostname  7.3.4. ipv4  7.3.5. ipv6  7.3.6. uri
  • 11.
     http://json-schema.org/examples.html a simple example  Requiredは最後にまとめて書くらしい  “uniqueItems” すげーイイ! ※xsdにもある模様: http://www.w3schools.com/schema/el_unique.asp  "warehouseLocation": { "description": "Coordinates of the warehouse with the product", "$ref": http://json-schema.org/geo }  → http://json-schema.org/documentation.html -> Standard schemas  Geographic Coordinate  Card  Calendar  Address
  • 12.