SUZURI API Documents
SUZURI API は、新しい商品の作成や、商品データの読み込みなど、SUZURIの基本的な機能へのアクセスを提供します。APIを使うことで、SUZURIの機能を利用した色々なアプリケーションやサービスを作ることができるようになります。
Overview
SUZURI API v1の概要について説明します。なお、ドキュメントの構成について、Qiita API v2のドキュメントを参考にさせていただきました。この場を借りて御礼申し上げます。
リクエスト
APIとの通信にはHTTPSプロトコルを利用します。エンドポイントは suzuri.jp/api/v1
です。
パラメータ
GET、POST、PUT、DELETEの4種類のHTTPメソッドを利用します。パラメータは、GETリクエストではURIクエリ、それ以外の場合にはapplication/json
形式のリクエストボディに含めることができます。各APIには任意で利用できるパラメータと、必ず含めなければならないパラメータがあります。どのようなパラメータがあるのかについては、このドキュメントの各API項目に記載しています。
ステータスコード
通常の処理が完了すると、APIはレスポンスボディとともにステータスコード200
(一部204
) を返します。また、正常な処理が行われなかった場合、APIは40x
系または50x
系のステータスコードを返します。このとき、レスポンスボディの中身は保証されないため、APIにリクエストした後は、はじめにステータスコードを確認するようにしてください。
レートリミット
一部APIにはレートリミットを設けてあります。レートリミットに関する情報はレスポンスヘッダに含められ、X-RateLimit-Limit
は最大回数、X-RateLimit-Remaining
は残り利用可能回数、X-RateLimit-Reset
は制限リセット時刻(UTC)を示します。
認証
すべてのリクエストにはアクセストークンの送信が必要です。アクセストークンは、後述するOAuthを利用した認可フローで発行するか、ユーザごとに付与されるAPIキーを利用することができます。
APIキー
ユーザ1人につき1つずつ、APIキーが付与されます。これは、開発や個人利用にお使いいただける、read
とwrite
スコープを持つ、ユーザのアクセストークンです。アプリケーションの管理画面で確認ができます。
アクセストークン
アクセストークンは、以下のようにAuthorizationリクエストヘッダに含められます。
Authorization: Bearer 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd
本ドキュメントには、各リクエストポイントにcurlサンプルが記載されていますが、上記ヘッダオプションについては省略されているものとします。実際にcurlコマンドでAPIを利用する際は、下記オプションを追加する必要があります。
-H "Authorization: Bearer 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd"
スコープ
アクセストークンはそれぞれ、スコープを持ちます。read
とwrite
という二種類のスコープがあります。開発者は、アプリケーションを登録する際に要求するスコープを指定する必要があり、アプリケーションを利用するユーザはどのスコープが要求されているかを認可画面で確認できます。すべての操作にはread
スコープが必須であり、情報の書き込みや削除、更新に関わるAPIではさらにwrite
スコープが必要になります。適切なスコープを持たないアクセストークンでのリクエストには401 Unauthorized
が返ります。
GET https://suzuri.jp/oauth/authorize
認可リクエストです。アクセストークンを発行するには、アプリケーションのユーザに認可画面を表示する必要があります。ユーザがアプリケーションからのアクセスを認可すると、アプリケーション登録時に指定されたURLにリダイレクトされ、その際にcode
が付与されます。アプリケーションでは、このcode
の値を利用して POST https://suzuri.jp/oauth/token
にリクエストを送り、アクセストークンを発行します。
Required Parameters
Name | Type | Description | Example |
---|---|---|---|
client_id | string | 登録されたAPIクライアントを特定するためのIDです。 | "b9f0b0a3ae23e9e93c5989829498d173e735024abe807c8e507036187e8c20fb" |
scope | string | アプリケーションが利用するスコープをスペース区切りで指定してください。 | "read write" |
redirect_uri | string | 認可コード付きでリダイレクトするuriを指定してください。 | "http://yourapplication.com/callback" |
response_type | string | 値は"code" でなければなりません。 |
"code" |
POST https://suzuri.jp/oauth/token
トークンリクエストです。以下のパラメータを application/x-www-form-urlencoded
フォーマットでリクエストすることで、アクセストークンを取得します。
Required Parameters
Name | Type | Description | Example |
---|---|---|---|
grant_type | string | 値は"authorization_code" でなければなりません。 |
"authorization_code" |
code | string | リダイレクトURIに付与された認可コードです。 | "07bedccac71b7ec68dfb6b5e77b07752414a7f76ed83055e98ceed8f4508e05c" |
redirect_uri | string | 認可リクエストに含まれていたものと同一の redirect_uri を指定してください。 |
"http://yourapplication.com/callback" |
client_id | string | 認可リクエストに含まれていたものと同一の client_id を指定してください。 |
"b9f0b0a3ae23e9e93c5989829498d173e735024abe807c8e507036187e8c20fb" |
client_secret | string | アプリケーション管理ページで確認できる client_secret を指定してください。 |
"bc75e3bcb3dac20eb8e18931ba4de36c0dbbd301c83813fb84891742659fabe9" |
JSON Schema
SUZURI APIは、APIを定義するJSON Schemaを公開しています。
下記コマンド、あるいはこのリンクより取得することができます。
$ curl -n -X GET https://suzuri.jp/api/v1/schema
お問い合わせ or ご意見・ご要望
本APIに関するお問い合わせや、ご意見・ご要望等ございましたら、 どうかお気軽に@suzurijpまでご連絡下さい!お待ちしております!
Activity(できごと)
ログインユーザに対しての、SUZURI内のできごとです。(売れた/ズッキュンがついたなど)
Activity(できごと) List
Activityのリストを取得します。
GET /api/v1/activities
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
limit | string | 取得するProductの数を指定します(デフォルトは10、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
Curl Example
$ curl -n -X GET /api/v1/activities
-G \
-d limit=30
Response Example
HTTP/1.1 200 OK
{
"activities": [
{
"message": "鹿さん が【去年の暮れあたりから蝶がついてきてるモグラ Tシャツ】にズッキュンしたよ。",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"eventType": "favorite",
"sender": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488",
"profile": {
"url": "https://suzuri.jp/",
"body": "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?",
"headerUrl": "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916"
},
"identities": [
{
"id": 1,
"provider": "twitter",
"uid": 1181557592,
"nickname": "surisurikun",
"url": "https://twitter.com/surisurikun"
}
]
}
}
]
}
Activity(できごと) Unreads Count
未読のActivityの数を取得します。
GET /api/v1/activities/unreads
Curl Example
$ curl -n -X GET /api/v1/activities/unreads
Response Example
HTTP/1.1 200 OK
{
"unreads": 3
}
Choice(オモイデ)
Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Choiceのid | 7 |
title | string | Choiceのタイトル | "スリスリピックアップ" |
description | nullable string | Choiceの説明文 | "猫の商品を沢山あつめてみました。" |
secret | boolean | Choiceの非公開フラグ(通常はfalse) | false |
bannerUrl | nullable uri | Choiceページのバナー画像URL | "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246" |
productsCount | integer | Choiceに入っているProductの数 | 1 |
user:id | integer | Userの一意なID | 1 |
user:name | string | Userの一意な名前 | "surisurikun" |
user:displayName | nullable string | ウェブページなどに表示するUserの名前 | "忍者スリスリくん" |
user:avatarUrl | nullable string | Userのアバター画像のURL | "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488" |
Choice(オモイデ) Info
idで指定したChoiceの情報を取得します。
GET /api/v1/choices/{choice_id}
Curl Example
$ curl -n -X GET /api/v1/choices/$CHOICE_ID
Response Example
HTTP/1.1 200 OK
{
"choice": {
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
}
Choice(オモイデ) Create
Choiceを作成します。
POST /api/v1/choices
Required Parameters
Name | Type | Description | Example |
---|---|---|---|
title | string | 作成するChoiceのタイトル | "スリスリピックアップ" |
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
description | string | 作成するChoiceの説明 | "猫の商品を沢山あつめてみました。" |
bannerUrl | string | 作成するChoiceのバナー画像URL | "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246" |
choiceProducts/productId | integer | Productの一意なID | 1 |
choiceProducts/itemVariantId | integer | アイテムバリエーションの一意なID | 1 |
Curl Example
$ curl -n -X POST /api/v1/choices \
-H "Content-Type: application/json" \
\
-d '{
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"choiceProducts": [
{
"productId": 1,
"itemVariantId": 1
}
]
}'
Response Example
HTTP/1.1 200 OK
{
"choice": {
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
}
Choice(オモイデ) Delete
Choiceを削除します。成功すると204を返します。
DELETE /api/v1/choices/{choice_id}
Curl Example
$ curl -n -X DELETE /api/v1/choices/$CHOICE_ID \
-H "Content-Type: application/json" \
Response Example
HTTP/1.1 204 No Content
レスポンスヘッダのみ返します
Choice(オモイデ) Add product
Choiceに指定したProductを追加します。
POST /api/v1/choices/{choice_id}
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
productId | integer | Choiceに追加したいProductのid Range: 1 <= value |
1 |
itemVariantId | integer | Choiceに追加したいProductのItem Variant (色とサイズの組み合わせ) id Range: 1 <= value |
1 |
Curl Example
$ curl -n -X POST /api/v1/choices/$CHOICE_ID \
-H "Content-Type: application/json" \
\
-d '{
"productId": 1,
"itemVariantId": 1
}'
Response Example
HTTP/1.1 200 OK
{
"choice": {
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
}
Choice(オモイデ) Remove product
Choiceから指定したProductを削除します。
POST /api/v1/choices/{choice_id}/remove
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
productId | integer | Choiceから削除したいProductのid Range: 1 <= value |
1 |
itemVariantId | integer | Choiceから削除したいProductのItem Variant (色とサイズの組み合わせ) id Range: 1 <= value |
1 |
Curl Example
$ curl -n -X POST /api/v1/choices/$CHOICE_ID/remove \
-H "Content-Type: application/json" \
\
-d '{
"productId": 1,
"itemVariantId": 1
}'
Response Example
HTTP/1.1 200 OK
{
"choice": {
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
}
Choice(オモイデ) Update
Choiceのタイトルや説明を更新します。
PUT /api/v1/choices/{choice_id}/
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
title | string | Choiceのタイトル | "スリスリピックアップ" |
description | nullable string | Choiceの説明文 | "猫の商品を沢山あつめてみました。" |
bannerUrl | nullable uri | Choiceページのバナー画像URL | "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246" |
choiceProducts/productId | integer | Productの一意なID | 1 |
choiceProducts/itemVariantId | integer | アイテムバリエーションの一意なID | 1 |
Curl Example
$ curl -n -X PUT /api/v1/choices/$CHOICE_ID/ \
-H "Content-Type: application/json" \
\
-d '{
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"choiceProducts": [
{
"productId": 1,
"itemVariantId": 1
}
]
}'
Response Example
HTTP/1.1 200 OK
{
"choice": {
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
}
Choice(オモイデ) List
Choiceの一覧を取得します。
GET /api/v1/choices
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
limit | string | 取得するChoiceの数の上限(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 15 |
offset | string | 取得するChoiceの開始位置 (デフォルトは0, 数字が大きいほど古い) pattern: [0-9][0-9]*$ | 100 |
userId | string | 取得するChoiceをUser id で絞り込む pattern: [1-9][0-9]*$ | 2 |
userName | string | 取得するChoiceをUser name で絞り込む pattern: [\w-]*$ | "surisurikun" |
Curl Example
$ curl -n -X GET /api/v1/choices
-G \
-d limit=15 \
-d offset=100 \
-d userId=2 \
-d userName=surisurikun
Response Example
HTTP/1.1 200 OK
{
"choices": [
{
"id": 7,
"title": "スリスリピックアップ",
"description": "猫の商品を沢山あつめてみました。",
"secret": false,
"bannerUrl": "https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246",
"productsCount": 1,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
],
"meta": {
"hasNext": true
}
}
Favorite(ズッキュン)
Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Favoriteのid | 7 |
count | integer | Favoriteの数 | 3 |
productId | integer | Favoriteの対象となる商品のid | 14 |
Favorite(ズッキュン) Product favorite list
指定したProductへのFavorite情報を取得します。(ズッキュンを行なったUser情報がレスポンスに含まれます)
GET /api/v1/products/{product_id}/favorites
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
itemId | string | 取得するFavoriteをItemのIDで絞り込む pattern: [1-9][0-9]*$ | 1 |
limit | string | 取得するFavoriteの数を指定します(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
offset | string | 取得するFavoriteの開始位置を指定します。 pattern: [0-9][0-9]*$ | 100 |
Curl Example
$ curl -n -X GET /api/v1/products/$PRODUCT_ID/favorites
-G \
-d itemId=1 \
-d limit=30 \
-d offset=100
Response Example
HTTP/1.1 200 OK
{
"favorites": [
{
"id": 7,
"count": 3,
"productId": 14,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
],
"meta": {
"hasNext": true
}
}
Favorite(ズッキュン) User favorite List
指定したUserによるFavorite情報を取得します。(対象のProduct情報がレスポンスに含まれます)
GET /api/v1/users/{user_id}/favorites
Curl Example
$ curl -n -X GET /api/v1/users/$USER_ID/favorites
Response Example
HTTP/1.1 200 OK
{
"favorites": [
{
"id": 7,
"count": 3,
"product": {
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
}
],
"meta": {
"hasNext": true
}
}
Favorite(ズッキュン) Create
ProductをFavoriteします。
POST /api/v1/products/{product_id}/favorites
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
anonymouse | boolean | 匿名のFavoriteとする場合true | true |
Curl Example
$ curl -n -X POST /api/v1/products/$PRODUCT_ID/favorites \
-H "Content-Type: application/json" \
\
-d '{
"anonymouse": true
}'
Response Example
HTTP/1.1 201 Created
{
"favorite": {
"id": 7,
"count": 3,
"rotation": 138,
"x": 0.5702,
"y": 0.5702
},
"meta": {
"totalCount": 10
}
}
Item(アイテム)
Item(アイテム)は、SUZURIで作ることができる商品の種類です。TシャツやマグカップなどのItem(アイテム)があります。
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Itemのid | 1 |
name | string | Itemの一意な名前 | "t-shirt" |
angles | array | Itemの画像におけるアングルの種類 | [1] |
humanizeName | string | Itemを表す名前 | "Tシャツ" |
Item(アイテム) List
全Itemのリストを取得します。
GET /api/v1/items
Curl Example
$ curl -n -X GET /api/v1/items
Response Example
HTTP/1.1 200 OK
{
"items": [
{
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ",
"variants": [
{
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
]
}
]
}
Material(素材)
Material(素材)は、Userがアップロードした画像によって生成される、Product(商品)を作るための素材です。ひとつのMaterialからは、Item一種類につき一つずつのProductを作ることができます。Materialから作ることのできる商品の種類は、Item List API を使って取得することができます。
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Materialのid | 31106 |
title | string | Materialのタイトル | "AAスリスリくん" |
description | nullable string | Materialの説明 | "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah." |
price | integer | Materialの値段 (いわゆるトリブン)。 | 100 |
violation | boolean | 違反フラグ (Materialが規約違反しているかどうか) | false |
published | boolean | 公開・非公開フラグ (Materialが公開されているときtrue) | true |
publishedAt | nullable date-time | Materialが公開された時間 | "2014-05-07T02:05:25.072+00:00" |
uploadedAt | date-time | Materialが更新された時間 | "2014-05-07T02:03:15.465+00:00" |
dominantRgb | nullable string | Materialの主張色のRGB | "#ffffff" |
originalWidth | integer | Materialの画像の横幅 | 1920 |
originalHeight | integer | Materialの画像の縦幅 | 1080 |
user:id | integer | Userの一意なID | 1 |
user:name | string | Userの一意な名前 | "surisurikun" |
user:displayName | nullable string | ウェブページなどに表示するUserの名前 | "忍者スリスリくん" |
user:avatarUrl | nullable string | Userのアバター画像のURL | "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488" |
Material(素材) List
Materialの一覧を取得します。
GET /api/v1/materials
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
limit | string | 取得するMaterialの数を指定します(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
offset | string | 取得するMaterialの開始位置を指定します。 pattern: [0-9][0-9]*$ | 100 |
userId | string | 取得するProductを Userのid で絞り込む pattern: [1-9][0-9]*$ | 2 |
Curl Example
$ curl -n -X GET /api/v1/materials
-G \
-d limit=30 \
-d offset=100 \
-d userId=2
Response Example
HTTP/1.1 200 OK
{
"materials": [
{
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
}
],
"meta": {
"hasNext": true
}
}
Material(素材) Create
画像からMaterialとProductを作ります。レートリミットが設けてあります。
POST /api/v1/materials
Required Parameters
Name | Type | Description | Example |
---|---|---|---|
texture | string | Materialの画像URL (データURIでも可) | "https://41.media.tumblr.com/QA9JpdgnOc8ov98s1C4S5EjJ_500.jpg" |
title | string | Materialのタイトル | "AAスリスリくん" |
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
price | integer | Materialの値段 (いわゆるトリブン)。 | 100 |
description | nullable string | Materialの説明 | "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah." |
products/itemId | integer | 作るProductのItemのid | 1 |
products/exemplaryItemVariantId | integer | 作るProductの代表的なItem Variant(色とサイズの組み合わせ)のid | 151 |
products/published | boolean | 作ったProductを公開する場合はtrue | true |
products/resizeMode | nullable string | 自動でリサイズするオプションです。contain を指定すると、プリント領域にぴったり収まるように画像を拡大・縮小します。cover を指定すると、できるだけプリント領域をちょうど埋めるように画像を拡大・縮小します。(cover は、スマートフォンケース、ノート、フルグラフィックTシャツでのみ有効) |
"contain" |
products/sub_materials/texture | string | SubMaterialの画像URL (データURIでも可) | "https://41.media.tumblr.com/QA9JpdgnOc8ov98s1C4S5EjJ_500.jpg" |
products/sub_materials/printSide | string | SubMaterial の印刷箇所を指定します。商品によって選択可能な印刷箇所が異なります。 | "back" |
products/sub_materials/enabled | boolean | 有効にする場合はtrue | true |
Curl Example
$ curl -n -X POST /api/v1/materials \
-H "Content-Type: application/json" \
\
-d '{
"texture": "https://41.media.tumblr.com/QA9JpdgnOc8ov98s1C4S5EjJ_500.jpg",
"title": "AAスリスリくん",
"price": 100,
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"products": [
{
"itemId": 1,
"exemplaryItemVariantId": 151,
"published": true,
"resizeMode": "contain",
"sub_materials": [
{
"texture": "https://41.media.tumblr.com/QA9JpdgnOc8ov98s1C4S5EjJ_500.jpg",
"printSide": "back",
"enabled": true
}
]
}
]
}'
Response Example
HTTP/1.1 200 OK
{
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"products": [
{
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
]
}
Material(素材) Update
Material及びProductの情報を更新します。Productsパラメータを指定した場合、このMaterialと指定したitemIdから成るProductがすでに存在する場合はProductの更新操作となり、存在しない場合はProductの作成操作となります。レートリミットが設けてあります
PUT /api/v1/materials/{material_id}
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
title | string | Materialのタイトル | "AAスリスリくん" |
price | integer | Materialの値段 (いわゆるトリブン)。 | 100 |
description | nullable string | Materialの説明 | "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah." |
products/itemId | integer | 更新するProductのItemのid | 1 |
products/exemplaryItemVariantId | integer | 更新するProductの代表的なItem Variant(色とサイズの組み合わせ)のid | 151 |
products/published | boolean | trueだと公開、falseだと非公開 | true |
products/resizeMode | nullable string | 自動でリサイズするオプション。contain を指定すると、プリント領域にぴったり収まるように画像を拡大・縮小 |
"contain" |
Curl Example
$ curl -n -X PUT /api/v1/materials/$MATERIAL_ID \
-H "Content-Type: application/json" \
\
-d '{
"title": "AAスリスリくん",
"price": 100,
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"products": [
{
"itemId": 1,
"exemplaryItemVariantId": 151,
"published": true,
"resizeMode": "contain"
}
]
}'
Response Example
HTTP/1.1 200 OK
{
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"products": [
{
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
]
}
Material(素材) Delete
Materialを削除します。紐付いたProductsもすべて削除されます。成功した時は204を返します。
DELETE /api/v1/materials/{material_id}
Curl Example
$ curl -n -X DELETE /api/v1/materials/$MATERIAL_ID \
-H "Content-Type: application/json" \
Response Example
HTTP/1.1 204 No Content
レスポンスヘッダのみ返します
Material(素材) Text
テキストからMaterialとTシャツを作ります。レートリミットが設けてあります。
POST /api/v1/materials/text
Required Parameters
Name | Type | Description | Example |
---|---|---|---|
text | string | Materialの元となるテキスト。255文字以下です。 | "AAスリスリくん" |
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
itemVariantId | integer | 作るTシャツのItemVariantId。TシャツのItemVariant以外はエラーとなります。利用できる値については、ItemList API を参照してください。指定されなかった場合、白のMで作られます。 |
1 |
Curl Example
$ curl -n -X POST /api/v1/materials/text \
-H "Content-Type: application/json" \
\
-d '{
"text": "AAスリスリくん",
"itemVariantId": 1
}'
Response Example
HTTP/1.1 200 OK
{
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"products": [
{
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
]
}
Product(商品)
Productは、Materialから生まれた各商品のことです。商品の値段は material:price と itemVariant:price によって決定されます。
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Productの一意なID | 1 |
title | string | Productのタイトル | "AAスリスリくん Tシャツ" |
published | boolean | 公開フラグ (公開されていれば真) | true |
publishedAt | nullable date-time | Productが公開された時間 | "2015-01-14T02:58:29.534+00:00" |
createdAt | date-time | Product作成された時間 | "2015-01-14T02:58:29.539+00:00" |
updatedAt | date-time | Productが更新された時間 | "2015-01-14T02:58:29.539+00:00" |
examplaryAngle | nullable string | Productの代表的角度(SUZURIのウェブサイトで使用されます) | "back" |
imageUrl | string | Product画像のURL。{} で囲まれた箇所は変数です。 次の値を入れて使用して下さい。{width}x{height} に画像のサイズ。(有効な値は 323x323 、765x765 ) {size}/{color} にアイテムサイズ/カラーの名前、[/angle] にはアングルの名前または空文字。 (有効な組み合わせは itemVariantsを参照) |
"https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b" |
sampleImageUrl | string | Product画像URLのサンプル | "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b" |
url | string | ProductのWebページのURL。{} で囲まれた箇所は変数です。 {size}/{color} にアイテムサイズ/カラーの名前を入れて使用して下さい。(有効な組み合わせは itemVariantsを参照) |
"https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}" |
sampleUrl | string | ProductページURLのサンプル | "https://suzuri.jp/surisurikun/31106/t-shirt/s/white" |
item:id | integer | Itemのid | 1 |
item:name | string | Itemの一意な名前 | "t-shirt" |
item:angles | array | Itemの画像におけるアングルの種類 | [1] |
item:humanizeName | string | Itemを表す名前 | "Tシャツ" |
material:id | integer | Materialのid | 31106 |
material:title | string | Materialのタイトル | "AAスリスリくん" |
material:description | nullable string | Materialの説明 | "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah." |
material:price | integer | Materialの値段 (いわゆるトリブン)。 | 100 |
material:violation | boolean | 違反フラグ (Materialが規約違反しているかどうか) | false |
material:published | boolean | 公開・非公開フラグ (Materialが公開されているときtrue) | true |
material:publishedAt | nullable date-time | Materialが公開された時間 | "2014-05-07T02:05:25.072+00:00" |
material:uploadedAt | date-time | Materialが更新された時間 | "2014-05-07T02:03:15.465+00:00" |
material:dominantRgb | nullable string | Materialの主張色のRGB | "#ffffff" |
material:originalWidth | integer | Materialの画像の横幅 | 1920 |
material:originalHeight | integer | Materialの画像の縦幅 | 1080 |
material:user:id | integer | Userの一意なID | 1 |
material:user:name | string | Userの一意な名前 | "surisurikun" |
material:user:displayName | nullable string | ウェブページなどに表示するUserの名前 | "忍者スリスリくん" |
material:user:avatarUrl | nullable string | Userのアバター画像のURL | "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488" |
sampleItemVariant:id | integer | アイテムバリエーションの一意なID | 1 |
sampleItemVariant:price | integer | アイテムバリエーションの原価 | 2080 |
sampleItemVariant:exemplary | boolean | 代表フラグ(代表のアイテムバリエーションが、SUZURIサイトの商品リストページに使用されます) | true |
sampleItemVariant:color:id | integer | アイテムカラーの一意なID | 1 |
sampleItemVariant:color:name | string | アイテムカラーの一意な名前 | "white" |
sampleItemVariant:color:rgb | string | アイテムカラーのRGB | "white" |
sampleItemVariant:size:id | integer | アイテムサイズの一意なID | 1 |
sampleItemVariant:size:name | string | アイテムサイズの一意な名前 | "s" |
Product(商品) List
複数のProduct情報を取得します。
GET /api/v1/products
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
itemId | string | 取得するProductをItemのIDで絞り込む pattern: [1-9][0-9]*$ | 1 |
limit | string | 取得するProductの数を指定します(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
offset | string | 取得するProductの開始位置を指定します。 pattern: [0-9][0-9]*$ | 100 |
userId | string | 取得するProductを User id で絞り込む pattern: [1-9][0-9]*$ | 2 |
userName | string | 取得するProductを User name で絞り込む pattern: [\w-]*$ | "surisurikun" |
materialId | string | 取得するProductを Material id で絞り込む pattern: [1-9][0-9]*$ | 101 |
Curl Example
$ curl -n -X GET /api/v1/products
-G \
-d itemId=1 \
-d limit=30 \
-d offset=100 \
-d userId=2 \
-d userName=surisurikun \
-d materialId=101
Response Example
HTTP/1.1 200 OK
{
"products": [
{
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
],
"meta": {
"hasNext": true
}
}
Product(商品) Search
Productをキーワード検索します。
GET /api/v1/products/search
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
limit | string | 取得するProductの数を指定します(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
offset | string | 取得するProductの開始位置を指定します。 pattern: [0-9][0-9]*$ | 100 |
q | string | 検索キーワード | "NINJYA" |
itemId | string | 取得するProductをItemのIDで絞り込む pattern: [1-9][0-9]*$ | 1 |
Curl Example
$ curl -n -X GET /api/v1/products/search
-G \
-d limit=30 \
-d offset=100 \
-d q=NINJYA \
-d itemId=1
Response Example
HTTP/1.1 200 OK
{
"products": [
{
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
],
"meta": {
"hasNext": true
}
}
Product(商品) Info
idを指定してProduct情報を取得します。
GET /api/v1/products/{product_id}
Curl Example
$ curl -n -X GET /api/v1/products/$PRODUCT_ID
Response Example
HTTP/1.1 200 OK
{
"products": {
"id": 1,
"title": "AAスリスリくん Tシャツ",
"published": true,
"publishedAt": "2015-01-14T02:58:29.534+00:00",
"createdAt": "2015-01-14T02:58:29.539+00:00",
"updatedAt": "2015-01-14T02:58:29.539+00:00",
"examplaryAngle": "back",
"imageUrl": "https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}[/angle]/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"sampleImageUrl": "https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b",
"url": "https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}",
"sampleUrl": "https://suzuri.jp/surisurikun/31106/t-shirt/s/white",
"item": {
"id": 1,
"name": "t-shirt",
"angles": [
1
],
"humanizeName": "Tシャツ"
},
"material": {
"id": 31106,
"title": "AAスリスリくん",
"description": "cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.",
"price": 100,
"violation": false,
"published": true,
"publishedAt": "2014-05-07T02:05:25.072+00:00",
"uploadedAt": "2014-05-07T02:03:15.465+00:00",
"dominantRgb": "#ffffff",
"originalWidth": 1920,
"originalHeight": 1080,
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"
}
},
"itemVariants": [
{
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
],
"sampleItemVariant": {
"id": 1,
"price": 2080,
"exemplary": true,
"color": {
"id": 1,
"name": "white",
"rgb": "white"
},
"size": {
"id": 1,
"name": "s"
}
}
}
}
User(ユーザ)
User(ユーザ)とは、SUZURIのユーザです。
Attributes
Name | Type | Description | Example |
---|---|---|---|
id | integer | Userの一意なID | 1 |
name | string | Userの一意な名前 | "surisurikun" |
displayName | nullable string | ウェブページなどに表示するUserの名前 | "忍者スリスリくん" |
avatarUrl | nullable string | Userのアバター画像のURL | "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488" |
profile:url | nullable string | ユーザのホームページのURL | "https://suzuri.jp/" |
profile:body | nullable string | プロフィールの詳細 | "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?" |
profile:headerUrl | nullable string | ユーザプロフィールページのヘッダ画像URL | "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916" |
identities | array | ユーザが認証に利用した外部サービス | [{"id"=>1, "provider"=>"twitter", "uid"=>1181557592, "nickname"=>"surisurikun", "url"=>"https://twitter.com/surisurikun"}] |
User(ユーザ) List
複数のUser情報を取得します。
GET /api/v1/users
Optional Parameters
Name | Type | Description | Example |
---|---|---|---|
name | string | Userのname pattern: [\w-]*$ | "surisurikun" |
limit | string | 取得するUsertの数を指定します(デフォルトは20、最大50) pattern: [1-9]|[1-4][0-9]|50$ | 30 |
offset | string | 取得するUserの開始位置を指定します。 pattern: [0-9][0-9]*$ | 100 |
Curl Example
$ curl -n -X GET /api/v1/users
-G \
-d name=surisurikun \
-d limit=30 \
-d offset=100
Response Example
HTTP/1.1 200 OK
{
"users": [
{
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488",
"profile": {
"url": "https://suzuri.jp/",
"body": "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?",
"headerUrl": "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916"
},
"identities": [
{
"id": 1,
"provider": "twitter",
"uid": 1181557592,
"nickname": "surisurikun",
"url": "https://twitter.com/surisurikun"
}
]
}
],
"meta": {
"hasNext": true
}
}
User(ユーザ) Info
idで指定したUserの情報を取得します
GET /api/v1/users/{user_id}
Curl Example
$ curl -n -X GET /api/v1/users/$USER_ID
Response Example
HTTP/1.1 200 OK
{
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488",
"profile": {
"url": "https://suzuri.jp/",
"body": "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?",
"headerUrl": "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916"
},
"identities": [
{
"id": 1,
"provider": "twitter",
"uid": 1181557592,
"nickname": "surisurikun",
"url": "https://twitter.com/surisurikun"
}
]
}
}
User(ユーザ) self
認証されたUserの情報を取得します
GET /api/v1/user
Curl Example
$ curl -n -X GET /api/v1/user
Response Example
HTTP/1.1 200 OK
{
"user": {
"id": 1,
"email": "hoge@suzuri.jp",
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488",
"profile": {
"url": "https://suzuri.jp/",
"body": "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?",
"headerUrl": "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916"
},
"identities": [
{
"id": 1,
"provider": "twitter",
"uid": 1181557592,
"nickname": "surisurikun",
"url": "https://twitter.com/surisurikun"
}
]
}
}
User(ユーザ) update
認証されたUserの情報を更新します
PUT /api/v1/user
Curl Example
$ curl -n -X PUT /api/v1/user \
-H "Content-Type: application/json" \
Response Example
HTTP/1.1 200 OK
{
"user": {
"id": 1,
"name": "surisurikun",
"displayName": "忍者スリスリくん",
"avatarUrl": "https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488",
"profile": {
"url": "https://suzuri.jp/",
"body": "こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?",
"headerUrl": "https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916"
},
"identities": [
{
"id": 1,
"provider": "twitter",
"uid": 1181557592,
"nickname": "surisurikun",
"url": "https://twitter.com/surisurikun"
}
]
}
}