会員情報アップロードAPI

会員情報アップロードAPI について

APIの他、バッチ処理によるアップロード機能もご利用いただけます。
詳細は営業担当・もしくはサポートまでお問い合わせください。

概要

利用方法

  • 当日受け付けた最後のAPIリクエストのみ、翌日早朝に取り込まれます
  • 既に取り込まれたものを削除し、全量洗い替えとして取り込まれます

※差分の追加、変更、削除のAPIは現状提供しておりません

利用例

  • 1日目、以下の会員の会員情報をAPIへリクエスト
    • AAAさん
    • BBBさん
    • CCCさん
  • 2日目、以下の会員の会員情報がFANSHIPへ取り込まれる
    • AAAさん
    • BBBさん
    • CCCさん
  • 2日目、以下の会員の会員情報をAPIへリクエスト
    • AAAさん
    • CCCさん
    • DDDさん
  • 3日目、以下の会員の会員情報がFANSHIPへ取り込まれる(全量洗い替えなので、BBBさんはいなくなる)
    • AAAさん
    • CCCさん
    • DDDさん

注意:最後に受け取ったAPIリクエストのみ取り込みます

不正なリクエスト

必須項目が指定されていないなど、バリデーションに違反するリクエストが行われた場合、400 Bad Requestを返却します。
存在しないキーが指定されていた場合、該当のキーが無視されます。

注意: 不正なキーが存在していても、該当キーが無視され正常に処理されます

URL

  • https://${hostname}/v1/2nd/members/_all

メソッド

  • POST

ファイルアップロード形式

multipart/form-dataによりアップロードします

コンテンツタイプ

  • Content-Type: multipart/form-data; boundary=----${Boundary}

FormData

以下のフォーマットに沿ったFormDataを使用します

  • Content-Disposition: form-data; name="filename"; filename="blob"
  • Content-Type: application/x-ndjson

ファイル形式

  • 行区切りJSON(x-ndjson)

スキーマ

キー名 タイプ 必須 意味 備考
id STRING 必須 会員ID
popinfo_id ARRAY[STRING] - popinfo_id
ad_id ARRAY[STRING] - 広告ID
status STRING - 会員ステータス 会員の状態を表す
last_name STRING -
first_name STRING -
gender STRING - 性別
age INTEGER - 年齢
birthday DATE - 生年月日
zip_code INTEGER - 郵便番号 ハイフン無し
address STRING - 住所
mail_address STRING - メールアドレス
phone_number STRING - 電話番号
mobile_number STRING - 携帯番号
marriage BOOLEAN - 既婚
occupation STRING - 職業
hobby STRING - 趣味
rank STRING - 会員ランク
created TIMESTAMP 必須 登録日時
property ARRAY[OBJECT] - 追加属性 [{"key": "key",
"value": "value"}]
property.key STRING - 追加属性(Key)
property.value STRING - 追加属性(Value)

JSONスキーマ

JSONスキーマを使用することで、行ごとにバリデーションを実施する事ができます。 ※Version: draft-07

{
    "type": "object",
    "properties": {
        "id": {
            "type": "string",
            "minLength": 1,
            "description": "会員ID",
            "examples": [
                "member_id"
            ]
        },
        "popinfo_id": {
            "type": ["array", "null"],
            "items": {
                "type": "string"
            },
            "default": null,
            "description": "popinfo_id",
            "examples": [
                ["d9d41097-bb8e-46e3-b5d0-cf014461f556"]
            ]
        },
        "ad_id": {
            "type": ["array", "null"],
            "items": {
                "type": "string"
            },
            "default": null,
            "description": "広告ID",
            "examples": [
                "d9d41097-bb8e-46e3-b5d0-cf014461f556"
            ]
        },
        "status": {
            "type": ["string", "null"],
            "default": null,
            "description": "会員ステータス(休眠など)",
            "examples": [
                "active"
            ]
        },
        "last_name": {
            "type": ["string", "null"],
            "default": null,
            "description": "姓",
            "examples": [
                "last_name"
            ]
        },
        "first_name": {
            "type": ["string", "null"],
            "default": null,
            "description": "名",
            "examples": [
                "first_name"
            ]
        },
        "gender": {
            "type": ["string", "null"],
            "default": null,
            "description": "性別",
            "examples": [
                "man"
            ]
        },
        "age": {
            "type": ["integer", "null"],
            "default": null,
            "description": "年齢",
            "examples": [
                20
            ]
        },
        "birthday": {
            "type": ["string", "null"],
            "format": "date",
            "default": null,
            "description": "誕生日",
            "examples": [
                "2000-01-01"
            ]
        },
        "zip_code": {
            "type": ["integer", "null"],
            "default": null,
            "description": "郵便番号",
            "examples": [
                1060041
            ]
        },
        "address": {
            "type": ["string", "null"],
            "default": null,
            "description": "住所",
            "examples": [
                "東京都港区麻布台1丁目11−9"
            ]
        },
        "mail_address": {
            "type": ["string", "null"],
            "default": null,
            "description": "メールアドレス",
            "examples": [
                "iridge@example.com"
            ]
        },
        "phone_number": {
            "type": ["string", "null"],
            "default": null,
            "description": "電話番号",
            "examples": [
                "123456789"
            ]
        },
        "mobile_number": {
            "type": ["string", "null"],
            "default": null,
            "description": "携帯番号",
            "examples": [
                "123456789"
            ]
        },
        "marriage": {
            "type": ["boolean", "null"],
            "default": null,
            "description": "既婚",
            "examples": [
                true
            ]
        },
        "occupation": {
            "type": ["string", "null"],
            "default": null,
            "description": "職業",
            "examples": [
                "engineer"
            ]
        },
        "hobby": {
            "type": ["string", "null"],
            "default": null,
            "description": "趣味",
            "examples": [
                "computer"
            ]
        },
        "rank": {
            "type": ["string", "null"],
            "default": null,
            "description": "会員ランク",
            "examples": [
                "A"
            ]
        },
        "created": {
            "type": "string",
            "format": "date-time",
            "description": "登録日時",
            "examples": [
                "2020-01-01T00:00:00+09:00"
            ]
        },
        "property": {
            "type": ["array", "null"],
            "items": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "value": {
                        "type": "string"
                    }
                }
            },
            "maxItems": 100,
            "description": "追加情報、key,valueで自由入力",
            "examples": [
                [{"key": "property_key", "value": "property_value"}]
            ]
        }
    },
    "required": ["id", "created"]
}

※追加属性となる「property」は最大100個まで設定可能となります

リクエストサンプル

curlコマンド

curl -X POST  -F 'filename=@members.json;type=application/x-ndjson' -H 'Authorization: Bearer ${AUTH_TOKEN}' 'https://${hostname}/v1/2nd/members/_all'

送信データ

POST /v1/2nd/members/_all HTTP/1.1
User-Agent: curl/7.35.0
Host: ${hostname}
Accept: */*
Authorization: Bearer ${AUTH_TOKEN}
Content-Length: 1600
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------161aea0535a2672f

--------------------------161aea0535a2672f
Content-Disposition: form-data; name="filename"; filename="members.json"
Content-Type: application/x-ndjson

{"id": "1", "last_name":"tanaka","first_name": "taro", "phone_number":"5678", "mobile_number": "123456789",   "popinfo_id": ["00", "01", "02"], "ad_id": ["id 10", "id 20", "id 30"], "status": "ad", "gender": "female", "age": 30, "birthday": "2019-02-11", "zip_code": 12121, "address": "213 chuoku,tokyo", "mail_address": "taro@123.com", "marriage": true, "occupation": "1", "hobby": "game", "rank": "1", "created": "2019-03-11T12:49:38.577626+09:00"}
{"id": "2", "last_name":"sato","first_name": "ichiro", "phone_number": null, "mobile_number": "123456789",   "popinfo_id": ["00", "01", "02"], "ad_id": ["id 10", "id 20", "id 30"], "status": "ad", "gender": "female", "age": 30, "birthday": "2019-02-11", "zip_code": 1810001, "address": "mitakashi,tokyo", "mail_address": "ichiro@123.com", "marriage": false, "occupation": "2", "hobby": "photo", "rank": "2", "created": "2019-03-12T12:49:38.577626+09:00"}
{"id": "3", "last_name":"ono","first_name": "hajime", "phone_number": null, "mobile_number": "123456789",   "popinfo_id": ["00", "01", "02"], "ad_id": ["id 10", "id 20", "id 30"], "status": "ad", "gender": "female", "age": 30, "birthday": "2019-02-11", "zip_code": 1150001, "address": "bunckyoku,tokyo", "mail_address": "hajime@123.com", "marriage": false, "occupation": "2", "hobby": null, "rank": "2", "created": "2019-03-14T12:49:38.577626+09:00"}

--------------------------161aea0535a2672f--