MAJIN WebAPIドキュメント
共通仕様
・API Keyをリクエストヘッダへ付加することで本APIのユーザー認証を行います。
・MAJIN へログインし「ダッシュボード > システム管理トップ > ユーザーアカウント」より、各ユーザーレコードの「アクション」列内の鍵アイコンからユーザー毎のAPI Keyをご確認いただけます。
項目 | 値 |
---|---|
プロトコル | HTTPS |
文字コード | UTF-8 |
日付データのタイムゾーン | UTC(00:00) |
本番環境URL | https://api.ma-jin.jp |
共通リクエストヘッダ
項目 | 値 |
---|---|
Content-Type (リクエスト) | application/x-www-form-urlencoded, multipart/form-data(ファイルを指定する場合) |
Content-Type (レスポンス) | application/json |
X-Authentication-Key | デベロッパー毎のユニークなAPI Key |
共通レスポンス
項目 | 値 |
---|---|
result | リクエスト成否(成功: success, 失敗: error) |
エラーレスポンス一覧
HTTP Status Code | 文言フォーマット(日本語) |
---|---|
400 | パラメータが不正です |
400 | パラメタ%sを入力してください |
400 | この予約は既に配信されています |
400 | この予約は既に停止されています |
400 | この予約は未だ配信されていません |
400 | プッシュの配信予約ではありません |
401 | アクセス権限がありません |
404 | キャンペーンが見つかりません |
404 | プッシュコンテンツが見つかりません |
404 | ターゲットリストが見つかりません |
404 | プッシュの配信予約データが見つかりません |
404 | %sが見つかりません |
500 | 不明なエラーが発生しました |
プッシュアプリケーションAPI ¶
概要
- MAJINへ登録済みのアプリケーション情報を取得することができます。
プラットフォームについて
-
MAJINのプッシュ通知において、配信対象のプラットフォームは下記のようなIDで区別されます。
-
※Webは今後実装予定のため、予約されています。
platform | 値(文字列) |
---|---|
Android | android |
iOS | ios |
Web | web |
取得(単体) ¶
取得(単体)GET/v1/push/applications/{app_id}
処理概要
- app_idに指定したアプリケーションの詳細情報を取得します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "MAJIN for SmartPhone",
"platform": [
"ios",
"android"
],
"bundle_id": "jp.co.geniee.majin.iphone",
"package_id": "jp.co.geniee.majin.android",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "アプリケーションが見つかりません"
}
取得(一覧) ¶
取得(一覧)GET/v1/push/applications{?limit,offset}
処理概要
- MAJINアカウント管理下のアプリケーションを全て取得します。
Example URI
- limit
number
(optional) Example: 100一度に取得する最大件数を指定します。最大数は100です。
- offset
number
(optional) Example: 0取得したいページ位置を指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"total": 100,
"limit": 2,
"offset": 10,
"items": [
{
"id": 1,
"name": "MAJIN for SmartPhone",
"platform": [
"ios",
"android"
],
"bundle_id": "jp.co.geniee.majin.iphone",
"package_id": "jp.co.geniee.majin.android",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
},
{
"id": 2,
"name": "MAJIN for SmartPhone",
"platform": [
"ios"
],
"bundle_id": "jp.co.geniee.majin.iphone",
"package_id": "jp.co.geniee.majin.android",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
プッシュ配信予約API ¶
概要
- プッシュ通知配信予約を管理するAPIです。
取得(単体) ¶
取得(単体)GET/v1/push/applications/{app_id}/campaigns/{campaign_id}
処理概要
- 指定したプッシュ配信予約情報を取得します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- campaign_id
number
(required) Example: 1取得したいキャンペーンIDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"repeat": true,
"repeat_type": "daily",
"end_date": null,
"start_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"segment_id": 1,
"direct_target_key": null,
"extra": {
"open_url": "http://ma-jin.jp"
},
"badge": 1,
"sound": true,
"icon": "/push/icon/1/icon.png",
"platform": [
"ios",
"android"
],
"send_per_minutes": null,
"is_sandbox": true,
"is_deletable": true,
"is_editable": true,
"is_startable": false,
"is_stoppable": true,
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00",
"schedules": [
{
"executed_at": "2016-11-30 12:00:00",
"status": "pending"
}
]
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "配信予約が見つかりません"
}
取得(一覧) ¶
取得(一覧)GET/v1/push/applications/{app_id}/campaigns{?limit,offset,platform,start_date}
処理概要
- 配信予約一覧を取得します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- limit
number
(optional) Example: 100一度に取得する最大件数を指定します。最大数は100です。
- offset
number
(optional) Example: 0取得したいページ位置を指定します
- platform
string
(optional) Example: ios配信対象のプラットフォームで検索対象を絞ります。
- start_date
string
(optional)配信開始日時で検索対象を絞ります。
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authencation-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
items: [
{
"id": 1,
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"start_date": "2016-11-30 12:00:00",
"end_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
"repeat": true,
"repeat_type": "daily",
"is_deletable": true,
"is_editable": true,
"is_startable": false,
"is_stoppable":false
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
新規作成 ¶
新規作成POST/v1/push/applications/{app_id}/campaigns
処理概要
- 配信予約を作成します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
-
name: (string, required) - 任意のキャンペーン名を指定します。
-
description: (string, optional) - キャンペーンに対して任意の詳細説明を指定します。
-
repeat: (bool, required) - 繰り返し配信の場合はtrueを指定します。デフォルトはfalseです。
-
repeat_type: (string, optional) - repeatにtrueを指定した場合は必須です。daily,weekly,monthlyの中から一つを指定します。
-
push_template_id: (string, optional) - repeatにtrueを指定した場合は必須です。プッシュコンテンツのIDを指定します。
-
start_date: (string, required) - プッシュ配信日時を指定します。必ず未来日時を指定してください。
-
end_date: (string, optional) - 繰り返し配信を終了する日時を指定します。
-
text: (string, required) - プッシュメッセージを指定します。
-
segment_id: (number, optional) - 配信対象のセグメントを指定します。direct_target_keyを指定した場合はdirect_target_keyが優先されます。segment_id, direct_target_key両方を指定しない場合は全デバイス対象となります。
-
direct_target_key: (file, optional) - 配信対象とするデバイストークンもしくはレジストレーションIDを1行ごとに記載したテキストファイルを指定します。文字コードはASCII、最大ファイルサイズは100MBです。
-
extra: (object, optional) - プッシュ受信時にアプリケーション側に渡したい値をJSON形式で指定します。
-
badge: (number, optional) - iOSプラットフォーム向け配信の場合のみ、値が処理されます。
-
sound: (bool, optional) - iOSプラットフォーム向け配信の場合のみ、値が処理されます。
-
icon: (file, optional) - Androidプラットフォーム向け配信の場合のみ、値が処理されます。
-
platform: (string, required) - 配信対象のプラットフォームを指定します。ios/android、両方の場合は,(カンマ)で連結した文字列を指定してください。
-
send_per_minutes: (number, optional) - 分間最大配信数を指定します。設定値は各OS毎の値となります。全送信に60分以上を要する値を設定した場合は、送信指定数の1/60に自動設定されます。
-
is_sandbox: (bool, optional) - 本番環境向け・デバッグ環境向けの配信かを指定します。デフォルトはtrueです。
Headers
Content-Type: multipart/form-data
Accept: application/json
X-Authentication-Key: API Key
Body
{
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"repeat": true,
"repeat_type": "daily",
"start_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"segment_id": 1,
"extra": {
"open_url": "http://ma-jin.jp"
},
"badge": 1,
"sound": true,
"platform": "ios,android",
"send_per_minutes": 10000,
"is_sandbox": true
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"repeat": true,
"repeat_type": "daily",
"end_date": null,
"start_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"segment_id": 1,
"direct_target_key": null,
"extra": {
"open_url": "http://ma-jin.jp"
},
"badge": 1,
"sound": true,
"icon": "/push/icon/1/test.png",
"platform": [
"ios",
"android"
],
"send_per_minutes": null,
"is_sandbox": true,
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00",
"is_deletable": true,
"is_editable": true,
"is_startable": false,
"is_stoppable": false,
"schedules": [
{
"executed_at": "2016-11-30 12:00:00",
"status": "pending"
},
{
"executed_at": "2016-11-31 12:00:00",
"status": "pending"
},
{
"executed_at": "2016-12-01 12:00:00",
"status": "pending"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
編集 ¶
編集PUT/v1/push/applications/{app_id}/campaigns/{campaign_id}
処理概要
- 指定したIDの配信予約を編集します
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- campaign_id
number
(required) Example: 1編集したい配信予約IDを指定します
-
name: (string, required) - 任意のキャンペーン名を指定します。
-
description: (string, optional) - キャンペーンに対して任意の詳細説明を指定します。
-
repeat_type: (string, optional) - repeatにtrueを指定した場合は必須です。daily,weekly,monthlyの中から一つを指定します。
-
start_date: (string, optional) - プッシュ配信日時を指定します。必ず未来日時を指定してください。
-
end_date: (string, optional) - 繰り返し配信を終了する日時を指定します。
-
text: (string, required) - プッシュメッセージを指定します。
-
segment_id: (number, optional) - 配信対象のセグメントを指定します。direct_target_keyを指定した場合はdirect_target_keyが優先されます。segment_id, direct_target_key両方を指定しない場合は全デバイス対象となります。
-
direct_target_key: (file, optional) - 配信対象とするデバイストークンもしくはレジストレーションIDを1行ごとに記載したテキストファイルを指定します。文字コードはASCII、最大ファイルサイズは100MBです。
-
extra: (object, optional) - プッシュ受信時にアプリケーション側に渡したい値をJSON形式で指定します。
-
badge: (number, optional) - iOSプラットフォーム向け配信の場合のみ、値が処理されます。
-
sound: (bool, optional) - iOSプラットフォーム向け配信の場合のみ、値が処理されます。
-
icon: (file, optional) - Androidプラットフォーム向け配信の場合のみ、値が処理されます。
- send_per_minutes: (number, optional) - 分間最大配信数を指定します。設定値は各OS毎の値となります。全送信に60分以上を要する値を設定した場合は、送信指定数の1/60に自動設定されます。
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
{
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"repeat": true,
"repeat_type": "daily",
"start_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"segment_id": 1,
"extra": {
"open_url": "http://ma-jin.jp"
},
"badge": 1,
"sound": true,
"platform": "ios,android",
"send_per_minutes": 10000,
"is_sandbox": true
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "キャンペーン名",
"description": "キャンペーン詳細情報",
"repeat": true,
"repeat_type": "daily",
"end_date": null,
"start_date": "2016-11-30 12:00:00",
"text": "プッシュメッセージ",
"segment_id": 1,
"direct_target_key": null,
"extra": {
"open_url": "http://ma-jin.jp"
},
"badge": 1,
"sound": true,
"icon": "/push/icon/1/icon.png",
"platform": [
"ios",
"android"
],
"send_per_minutes": null,
"is_sandbox": true,
"is_deletable": true,
"is_editable": true,
"is_startable": false,
"is_stoppable": false,
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00",
"schedules": [
{
"executed_at": "2016-11-30 12:00:00",
"status": "pending"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "配信予約が見つかりません"
}
停止 ¶
停止PUT/v1/push/applications/{app_id}/campaigns/{campaign_id}/stop
処理概要
- 指定したIDの配信予約を停止します。停止された配信予約は再開するまでの間は配信が行われません。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- campaign_id
number
(required) Example: 1編集したい配信予約IDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success"
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
再開 ¶
再開PUT/v1/push/applications/{app_id}/campaigns/{campaign_id}/restart
処理概要
- 指定したIDの配信予約を再開します。停止状態の配信予約のみに有効です。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- campaign_id
number
(required) Example: 1編集したい配信予約IDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success"
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
削除 ¶
削除DELETE/v1/push/applications/{app_id}/campaigns/{campaign_id}
処理概要
- 指定したIDの配信予約を削除します
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- campaign_id
number
(required) Example: 1削除したい配信予約IDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "配信予約が見つかりません"
}
プッシュカスタム属性API ¶
概要
- デベロッパー任意の値をMAJINに定義することができます。属性を定義し、ネイティブSDKより該当する属性に対して値を送信することで、属性値に応じてセグメントを作成することができます。
typeに指定可能な型
- 指定可能な型は下記の6つとなります。
type | 詳細 |
---|---|
bool | 論理型属性を作成します。true, falseを保存できます。 |
sint | 数値型属性を作成します。整数値などを保存する際に使用します。 |
string | 文字列型属性を作成します。任意の文字列を保存できます。 |
string_array | 文字配列型属性を作成します。任意文字列の配列を保存できます。 |
date | 日付型属性を作成します。時刻データを含まない日付データを保存できます。 |
timestamp | 日時型属性を作成します。日付に加え、時刻データを保存できます。 |
取得(単体) ¶
取得(単体)GET/v1/attributes/{attribute_id}
処理概要
-
attribute_idに指定したカスタム属性を取得します。
-
attribute_idは指定必須です。
Example URI
- attribute_id
number
(required) Example: 1取得したいカスタム属性IDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"type": "string",
"name": "文字列フィールド",
"db_field": "_string_field1",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "カスタム属性が見つかりません"
}
取得(一覧) ¶
取得(一覧)GET/v1/attributes{?limit,offset}
処理概要
-
カスタム属性の一覧を取得します
-
limitを指定すると指定した件数を超えない件数分が一度に取得されます
-
offsetには取得したいページ位置を指定します
Example URI
- limit
number
(optional) Example: 100一度に取得する最大件数を指定します
- offset
number
(optional) Example: 0取得したいページ位置を指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"total": 100,
"limit": 50,
"offset": 10,
"items": [
{
"id": 1,
"type": "string",
"name": "文字列フィールド",
"db_field": "_string_field1",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
新規作成 ¶
新規作成POST/v1/attributes
処理概要
- カスタム属性を作成します。
Example URI
-
type: (string, required) - 保存するデータの型を指定します。
-
name: (string, optional) - 任意の名前を指定します。(UTF-8, 1〜64字)
-
db_field: (string, optional) - DB上のフィールド名を指定します。(先頭文字_(アンダースコア)の大小英数字, 1〜64字)
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
{
"type": "string",
"name": "文字列フィールド",
"db_field": "_string_field1"
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"type": "string",
"name": "文字列フィールド",
"db_field": "_string_field1",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
編集 ¶
編集PUT/v1/attributes/{attribute_id}
処理概要
-
指定したIDのカスタム属性を編集します
-
attribute_idは指定必須です。
Example URI
- attribute_id
number
(required) Example: 1編集したいカスタム属性IDを指定します
- name: (string, optional) - 任意の名前を指定します。(UTF-8, 1〜64字)
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
{
"name": "NEW文字列フィールド",
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"type": "string",
"name": "NEW文字列フィールド",
"db_field": "_string_field1",
"created_at": "2016-11-30 12:00:00",
"updated_at": "2016-11-30 12:00:00"
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "カスタム属性が見つかりません"
}
削除 ¶
削除DELETE/v1/attributes/{attribute_id}
処理概要
-
指定したIDのカスタム属性を削除します
-
attribute_idは指定必須です
Example URI
- attribute_id
number
(required) Example: 1削除したいカスタム属性IDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "カスタム属性が見つかりません"
}
プッシュセグメントAPI ¶
概要
- プッシュユーザー向けのセグメントを取得・作成・変更することができます。
特殊フィールド
- システムで予約されたフィールドおよびデータタイプに応じて、フィールド名の先頭にprefixを指定する必要があります。
type | prefix |
---|---|
カスタム属性 | _ |
プラットフォーム | @ |
conditions.operatorに指定可能な演算子
- カスタム属性として定義したデータの型に応じて指定できる演算子が異なります。演算子はそれぞれ下記のような文字列で指定します。
type | 詳細 |
---|---|
bool | none, eq |
sint | none, eq, not_eq, gt, gte, lt, lte |
string | none, eq, not_eq, contains, not_contains, forward_match |
string_array | none, size_gte, size_lt, size_eq, contains, not_contains |
timestamp | none, relative_year_eq, relative_year_after_eq, relative_year_before_eq, relative_month_eq, relative_month_after_eq, relative_month_before_eq, relative_date_eq, relative_date_after_eq, relative_date_before_eq, relative_hour_before_gte, relative_hour_before_lte, relative_minute_before_gte, relative_minute_before_lte, relative_second_before_gte, relative_second_before_lte |
取得(単体) ¶
取得(単体)GET/v1/push/applications/{app_id}/segments/{segment_id}
処理概要
- app_idに紐づくsegment_idに指定したセグメント情報を取得します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- segment_id
number
(required) Example: 1取得したいセグメントIDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"version": 1,
"expected_send_count": 1,
"status": "completed",
"op": "and",
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "セグメントが見つかりません"
}
取得(一覧) ¶
取得(一覧)GET/v1/push/applications/{app_id}/segments{?limit,offset}
処理概要
- app_idに紐づくセグメントを取得します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- limit
number
(optional) Example: 100一度に取得する最大件数を指定します
- offset
number
(optional) Example: 0取得したいページ位置を指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: applicaiton/json
Body
{
"result": "success",
"data": {
"total": 100,
"limit": 50,
"offset": 10,
"items": [
{
"id": 1,
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"version": 1,
"expected_send_count": None,
"status": "unrequested",
"op": "and",
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
新規作成 ¶
新規作成POST/v1/push/applications/{app_id}/segments
処理概要
- プッシュ通知の配信対象となるセグメントを作成します。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
-
name: (string, required) - 任意のセグメント名を指定します。(1〜255字)
-
description: (string, optional) - セグメントに対する任意の説明文を指定します。
-
is_sandbox: (bool, required) - 本番環境向けかデバッグ環境向けかを指定します。
-
conditions: (array, required) - セグメント対象の条件を指定します。
- (object)
- name: (string, required) - 対象の属性DBフィールド名またはデータフィールド名を指定します。
- operator: (string, required) - name, valueの比較演算子を指定します。
- value: (any, required) - 条件となる値を指定します。
- (object)
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
{
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"version": 1,
"expected_send_count": 1,
"status": "unrequested",
"op": "and",
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
編集 ¶
編集PUT/v1/push/applications/{app_id}/segments/{segment_id}
処理概要
-
指定したIDのセグメントを編集します
-
segment_idは指定必須です。
Example URI
- app_id
number
(required) Example: 1アプリケーションIDを指定します
- segment_id
number
(required) Example: 1取得したいセグメントIDを指定します
-
name: (string, required) - 任意のセグメント名を指定します。(1〜255字)
-
description: (string, optional) - セグメントに対する任意の説明文を指定します。
-
is_sandbox: (bool, required) - 本番環境向けかデバッグ環境向けかを指定します。
-
conditions: (array, required) - セグメント対象の条件を指定します。
- (object)
- name: (string, required) - 対象の属性DBフィールド名またはデータフィールド名を指定します。
- operator: (string, required) - name, valueの比較演算子を指定します。
- value: (any, required) - 条件となる値を指定します。
- (object)
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
{
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"id": 1,
"name": "ios_users",
"description": "this is description",
"is_sandbox": true,
"version": 1,
"expected_send_count": None,
"status": "unrequested",
"op": "and",
"conditions": [
{
"name": "_age",
"operator": "eq",
"value": 123
},
{
"name": "@platform",
"operator": "eq",
"value": "ios"
}
]
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "パラメータが不正です"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "セグメントが見つかりません"
}
削除 ¶
削除DELETE/v1/push/applications/{app_id}/segments/{segment_id}
処理概要
- 指定したIDのセグメントを削除します
Example URI
- app_id
nubmer
(required) Example: 1アプリケーションIDを指定します
- segment_id
number
(required) Example: 1削除したいセグメントIDを指定します
Headers
Content-Type: application/x-www-form-urlencoded
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success"
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "セグメントが見つかりません"
}
カスタマーAPI ¶
概要
- カスタマーをMAJINに追加や変更することができます。登録したカスタマーを画面上で管理することができます。
fieldに指定可能な値
-
カスタムフィールドまたは属性:カスタムフィールドまたは属性の
db_field
。 -
ラベル:
#
+ ラベルID。 -
MAJINの標準フィールド:下記のフィールドが使用可能です。
Field | 必須 | type | 説明 |
---|---|---|---|
YES | string | メールアドレス | |
last_name | NO | string | 姓(漢字) |
first_name | NO | string | 名(漢字) |
last_name_pronunciation | NO | string | 姓(かな) |
first_name_pronunciation | NO | string | 名(かな) |
company | NO | string | 会社名 |
department | NO | string | 部署・部門 |
position | NO | string | 役職 |
bounce_flag | NO | boolean | 配信可否コード(例:false=配信可能, true=配信不可) |
address_country | NO | string | 国名(例:日本) |
address_prefecture | NO | string | 都道府県(例:東京都) |
address_postcode | NO | string | 郵便番号 |
address_city | NO | string | 住所:市・区 |
address_line1 | NO | string | 住所:町・番地 |
address_line2 | NO | string | 住所:ビル・マンション名 |
phone_number | NO | string | 電話番号 |
fax_number | NO | string | FAX番号 |
comment | NO | string | コメント内容 |
account_executive_id | NO | uint | 担当者のユーザID |
※ 担当者のユーザIDは、管理画面上のユーザアカウント一覧から確認することができます。
追加 ¶
追加POST/customers{?___member_id}
処理概要
-
カスタマーを作成します。
-
___member_idを指定するとカスタマーに会員IDを設定できます。
Example URI
- ___member_id
string
(optional) Example: abc123カスタマーの会員IDを設定します
- customer
object
(required) Example: 1カスタマーの情報を設定します
Headers
Content-Type: application/json
Accept: application/json
X-Authentication-Key: API Key
Body
{
"customer": {
"email": "dummy@geniee.co.jp",
"last_name": "ジーニー",
"first_name": "太郎",
"company": "株式会社ジーニー",
"bounce_flag": false,
"address_city": "新宿区",
"address_country": "日本",
"address_prefecture": "東京都",
"#1": true,
"#2": true,
"#11": true,
"myStringField": "dummy_string",
"myNumberField": "dummy_number",
"myDateField": "2016-12-12",
"myDateTimeField": "2016-12-12 12:00:00",
"mySingleChoiceField": "チョイス1",
"myMultipleChoiceField": ["チョイス1", "チョイス2"],
"_test_date_field": "2016-11-12",
"_test_datetime_field": "2016-11-12 12:00:00",
"_test_sint_field": -12,
"_test_boolean_field": false,
}
}
201
Headers
Content-Type: application/json
Body
{
"result": "success",
}
401
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "access denied."
}
変更 ¶
変更PUT/customers/{customer_id}{?___member_id}
処理概要
-
customer_idに指定したカスタマーを変更します。
-
___member_idを指定するとカスタマーに会員IDを設定できます。
Example URI
- customer_id
string
(required) Example: "d7024eb1ff4b-4fab-8123-6333bdb62dfd" (string, required) - カスタマーのカスタマーID
- ___member_id
string
(optional) Example: abc123カスタマーの会員IDを設定します
- customer
object
(required)カスタマーの情報を設定します
Headers
Content-Type: application/json
Accept: application/json
X-Authentication-Key: API Key
Body
{
"customer": {
"email": "dummy@geniee.co.jp",
"last_name": "ジーニー",
"first_name": "太郎",
"company": "株式会社ジーニー",
"bounce_flag": false,
"address_city": "新宿区",
"address_country": "日本",
"address_prefecture": "東京都",
"#1": true,
"#2": true,
"#11": true,
"myStringField": "dummy_string",
"myNumberField": "dummy_number",
"myDateField": "2016-12-12",
"myDateTimeField": "2016-12-12 12:00:00",
"mySingleChoiceField": "チョイス1",
"myMultipleChoiceField": ["チョイス1", "チョイス2"],
"_test_date_field": "2016-11-12",
"_test_datetime_field": "2016-11-12 12:00:00",
"_test_sint_field": -12,
"_test_boolean_field": false,
}
}
201
Headers
Content-Type: application/json
Body
{
"result": "success",
}
401
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "access denied."
}
取得(単体) ¶
取得(単体)GET/customers/{customer_id}
処理概要
- customer_idに指定したカスタム情報を取得します。
Example URI
- customer_id
string
(required) Example: 1取得したいカスタマーIDを指定します
Headers
Content-Type: application/json
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"customer_id": "d7024eb1-ff4b-4fab-8123-6333bdb62dfd",
"email": "dummy@geniee.co.jp",
"last_name": "ジーニー",
"first_name": "太郎",
"company": "株式会社ジーニー",
"bounce_flag": false,
"address_city": "新宿区",
"address_country": "日本",
"address_prefecture": "東京都",
"#1": true,
"#2": true,
"#11": true,
"myStringField": "dummy_string",
"myNumberField": "dummy_number",
"myDateField": "2016-12-12",
"myDateTimeField": "2016-12-12 12:00:00",
"myBooleanField": False,
"mySingleChoiceField": "チョイス1",
"myMultipleChoiceField": ["チョイス1", "チョイス2"],
"_test_date_field": "2016-11-12",
"_test_datetime_field": "2016-11-12 12:00:00",
"_test_sint_field": -12,
"_test_string_array_field": ["文字列A", "文字列B"],
"_test_boolean_field": false,
"score": 1,
"last_updated_at": "2016-12-13 11:12:13"
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
}
401
Headers
Content-Type: application/json
Body
{
"result": "access denied",
}
メールアドレスで取得(単体) ¶
メールアドレスで取得(単体)GET/customers/email/{email}
処理概要
- emailに指定したメールアドレスを有するカスタム情報を取得します。
Example URI
string
(required) Example: 1取得したいカスタマーのメールアドレスを指定します。
Headers
Content-Type: application/json
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"customer_id": "d7024eb1-ff4b-4fab-8123-6333bdb62dfd",
"email": "dummy@geniee.co.jp",
"last_name": "ジーニー",
"first_name": "太郎",
"company": "株式会社ジーニー",
"bounce_flag": false,
"address_city": "新宿区",
"address_country": "日本",
"address_prefecture": "東京都",
"#1": true,
"#2": true,
"#11": true,
"myStringField": "dummy_string",
"myNumberField": "dummy_number",
"myDateField": "2016-12-12",
"myDateTimeField": "2016-12-12 12:00:00",
"myBooleanField": False,
"mySingleChoiceField": "チョイス1",
"myMultipleChoiceField": ["チョイス1", "チョイス2"],
"_test_date_field": "2016-11-12",
"_test_datetime_field": "2016-11-12 12:00:00",
"_test_sint_field": -12,
"_test_string_array_field": ["文字列A", "文字列B"],
"_test_boolean_field": false,
"score": 1,
"last_updated_at": "2016-12-13 11:12:13"
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
}
401
Headers
Content-Type: application/json
Body
{
"result": "access denied",
}
インポート ¶
インポートPOST/customers/import
処理概要
Example URI
- file
file
(required)インポートするファイル、20M以下の50000行以内のCSVファイルが必須です。CSVのヘッダーはフィールドの使用可能値となります。
- encode
string
(required)CSVファイルのエンコード形式(
utf-8
またはshift-jis
)。- mode
string
(required)インポートのモード。
-
insert
: データベースに存在しないカスタマーのみを追加登録します。 -
update
: データベースに存在する既存のカスタマー情報のみ更新されます。 -
upsert
: データベースに存在しないなら追加登録します。データベースに存在するならカスタマー情報が更新されます。
※ ヘッダーに含むフィールドのみが追加や更新の対象となります。 ヘッダーに含まれるフィールドの値が空白であっても更新されます。
-
Headers
Content-Type: multipart/form-data
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"import_job_id": 12
}
}
400
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "インポートに失敗しました。"
}
インポート状態を取得 ¶
インポート状態を取得GET/customers/import/jobs/{import_job_id}
処理概要
Example URI
- import_job_id
number
(required)インポート時に作成した問い合わせ用ID
Headers
Content-Type: application/json
Accept: application/json
X-Authentication-Key: API Key
Body
なし
200
status (number) - インポート状態
1: 処理中のステータス
2: 完了のステータス
3: 処理待ちのステータス
9: 中断された場合のステータス(詳細はimport_job_idを添えてお問い合わせください)
inserted (number) 新規登録件数
updated (number) 更新件数
failed (number) 登録失敗件数
skipped (number) インポート時のmodeと一致しないカスタマーをスキップした件数
summary (string) failedされた行番号と原因
Headers
Content-Type: application/json
Body
{
"result": "success",
"data": {
"status": 2,
"inserted": 1000,
"updated": 0,
"failed": 2,
"skipped": 2,
"summary": "[Line:2] 担当者メールアドレス[account_executive_id]に存在しない値が設定されています"
}
}
404
Headers
Content-Type: application/json
Body
{
"result": "error",
"message": "セグメントが見つかりません"
}