ユーザー
users > modify
ユーザー情報を変更します。
注:ユーザーを作成する前に、メール、ログインID、ユーザー名が有効で利用可能であることを確認してください。
API関数 users > email_check , users > username_check , users > alias_check を利用してください。
リクエストの構築
リクエストURLとGET変数
リクエスト固有のGET変数
| 変数 | 値 | 説明 |
|---|---|---|
| go | users | APIセクション |
| do | modify | APIアクション |
| iq | User ID | ユーザーID |
リクエストURLは以下のようになります。必須情報(key, timestamp, salt, signature)を追加することを忘れないでください。
https://....../api.php?go=users&do=modify&iq={user_id}&{required information}
POST変数
以下のPOST変数はオプションです。
| 変数 | 値 | 説明 |
|---|---|---|
| notify_webmaster | (int) 0|1 | INTER-STREAMのウェブマスターに通知メッセージを送信するかどうか |
| password | (string) Password | パスワード |
| alias | (string) Alias | ユーザー名(最大60文字) |
以下のPOST変数はオプションです(Advanced User Management機能拡張が必要です)。
| 変数 | 値 | 説明 |
|---|---|---|
| login | (string) Username | ログインID(最大40文字)※必ず最初に確認してください。 |
| status | (int) status | 利用可能な値:0 (アクティブ), 1 (非アクティブ), 2 (保留中) |
| access_level | (int) access level | 利用可能な値:0(ウェブマスター), 1(管理者), 2(寄稿者), 3(投稿者), 4(有料購読者),5(無料購読者) |
| id_privilege_set | (int) ID privilege set | 特権セットのID。※アクセスレベルが指定されている場合のみ 指定しない場合、ユーザーに割り当てられたアクセスレベルに設定されているデフォルトの特権が使用されます。 |
| cms_access | (int) 0|1 | ユーザーにコンテンツ管理インターフェイスへのアクセスを許可するかどうか |
| content_creation_limits | (int) 0|1 | 利用可能な値:0(グローバル), 1(固有、ユーザーごと) ※アクセスレベル=2(寄稿者)もしくは3(投稿者)の場合のみ |
| max_created_clips | (string) limits | 5つのカンマ区切り値(動画タイプごとにひとつ)※"content_creation_limits=1"の場合のみ 例:'100,100,1,100,100'は「100個の標準動画、100個のStream VOD、1個のStream Live、100個の埋め込み動画、および100個のオートエンコーディング動画」を意味します。 注:"0"=制限なし |
| max_created_channels | (int) limit | 動画チャンネルの最大数 ※"content_creation_limits=1"の場合のみ 注:"0"=制限なし |
| max_created_news | (int) limit | ニュース/イベントの最大数 ※"content_creation_limits=1"の場合のみ 注:"0"=制限なし |
| max_created_galleries | (int) limit | ギャラリーの最大数 ※"content_creation_limits=1"の場合のみ 注:"0"=制限なし |
| max_created_assorted_files | (int) limit | 関連画像の最大数 ※"content_creation_limits=1"の場合のみ 注:"0"=制限なし |
| max_video_upload_size | (int) limit | アップロード動画サイズの上限 ※"content_creation_limits=1"の場合のみ |
| terms_conditions_accepted | (int) 0|1 | ユーザーが利用規約に同意したかどうか。 |
| privacy_policy_accepted | (int) 0|1 | ユーザーがプライバシーポリシーに同意したかどうか。 |
| eml_receive_site_news | (int) 0|1 | ユーザーがINTER-STREAMからのメールニュースの受信に同意したかどうか。 |
| eml_receive_new_content_digest | (int) 0|1 | ユーザーがINTER-STREAMからの新着コンテンツダイジェストの受信に同意したかどうか。 |
| name | (string) name | ユーザー名(下の名前) |
| surname | (string) surname | ユーザー名(姓) |
| gender | (int) gender | 利用可能な値:0 (不明), 1 (男性), 2 (女性) |
| birthdate_y | (int) year | 誕生年(4ケタ) |
| birthdate_m | (int) month | 誕生月(1-12) |
| birthdate_d | (int) day | 誕生日(1-31) |
| company | (string) organization | 会社もしくは組織 |
| vat | (string) VAT | 会計/税識別番号 |
| address | (string) address | 住所 |
| pastal_code | (string) postal code | 郵便番号 |
| country | (string) country | 国名 |
| telephone | (string) telephone | 電話番号 |
| web | (string) URL | ウェブサイト |
| notes | (string) notes | 管理者向けの備考 このフィールドはウェブマスターならびに管理者にのみ表示されます。 |
| avatar_display | (int) avatar mode | 利用可能な値:0 (デフォルト), 1 (Gravatar, Mistery-Man), 2 (Gravatar, Identicon), 3 (Gravatar, Monsterid), 4 (Gravatar, Wavatar), 5 (Gravatar, Retro) |
| social_page_facebook | (string) URL | facebookのプロフィールページURL |
| social_page_googleplus | (string) URL | googleplusのプロフィールページURL |
| social_page_twitter | (string) URL | twitterのプロフィールページURL |
| social_page_linkedin | (string) URL | linkedinのプロフィールページURL |
| social_page_instagram | (string) URL | instagramのプロフィールページURL |
| social_page_flickr | (string) URL | flickrのプロフィールページURL |
| social_page_vkontakte | (string) URL | vkontakteのプロフィールページURL |
| social_page_tuenti | (string) URL | tuentiのプロフィールページURL |
| social_page_other | (string) URL | その他のプロフィールページURL |
| profile_page_privacy | (int) privacy | ユーザープロフィールページを公開するかどうか 利用可能な値:0(公開), 1(INTER-STREAMユーザーにのみ公開), 2(非公開) |
| profile_page_about | (string) text | ユーザーの公開「About」テキスト |
| profile_page_show_country | (int) 0|1 | ユーザーの国を公開プロフィールに表示するかどうか |
| profile_page_show_web | (int) 0|1 | ユーザーのウェブサイトを公開プロフィールに表示するかどうか |
| profile_page_show_social | (int) 0|1 | ユーザーのSNSリンクを公開プロフィールに表示するかどうか |
応答例
リクエストが成功した場合は、以下の内容のレスポンスを受け取ります。
・data:ユーザー情報(変更後)
{
"data": {
"access_level": "0",
"activation_key": "u4o3cv0wz3u1w3r6rjay",
"address": "",
"alias": "WebTV",
"avatar_display": "0",
"birthdate": "0000-00-00",
"cms_access": "1",
"company": "",
"country": "Usa",
"date_lastmod": "1426093858",
"email": "sampleemail@domain.ext",
"gender": "1",
"general_cvp_expiration": "0",
"id": "1",
"img_gravatar_url": "",
"img_icon": "http:\/\/......\/public\/common\/images\/_default_user_icon.gif",
"img_social": "http:\/\/......\/public\/common\/images\/_default_user_social.gif",
"img_thumbnail": "http:\/\/......\/public\/common\/images\/_default_user_thumb.gif",
"last_ip": "xxx.xxx.xxx.xxx",
"last_ip_update": "1427695411",
"last_login": "1427695411",
"login": "admin",
"name": "",
"notes": "",
"postal_code": "",
"profile_page_about": "The WebTV Admin....",
"profile_page_privacy": "0",
"profile_page_show_country": "1",
"profile_page_show_social": "1",
"profile_page_show_web": "1",
"reg_ip": "xxx.xxx.xxx.xxx",
"reg_referer": "",
"reg_timestamp": "0",
"reg_useragent": "",
"session_id": "q6mvdcliagb55mrjylzq",
"session_time": "1427695426",
"social_page_facebook": "",
"social_page_flickr": "",
"social_page_googleplus": "",
"social_page_linkedin": "",
"social_page_other": "",
"social_page_tuenti": "",
"social_page_twitter": "",
"social_page_vkontakte": "",
"status": "1",
"surname": "",
"telephone": "",
"url": "http:\/\/......\/index.php\/portal\/user\/1\/webtv\/",
"vat": "",
"web": "http:\/\/......\/"
}
}
リクエストにハッシュが指定されていない場合など、リクエストが失敗した場合のレスポンス
{
"error": "REQUEST_ERROR",
"error_long": "Missing signature"
}
このリクエストは以下のエラーを返す可能性があります。
・REQUEST_ERROR | Invalid User ID
ユーザーIDが1未満かもしくは数値ではありません。
・USER_NOT_FOUND | It was not possible to find an User with the supplied ID
指定されたIDと紐付くユーザーが見つかりません。
その他のエラー内容に関しては一般的なエラーメッセージを確認してください。
PHPサンプルコード
GETおよびPOSTデータを準備します。
// GET変数
$GET_VARS = array(
"go" => "users",
"do" => "modify",
"iq" => 3
);
// POST変数
$POST_VARS = array(
"alias" => "New Alias" // エイリアスのみを変更
);
salt, timestamp, signatureを生成してリクエストを送信します。
以下のコードブロックはすべてのハッシュつきリクエストに共通です。
// APIベースURLと認証情報の収集
$API_URL = "https://www.interstreamdomain.tv/api.php";
$API_KEY_ID = "1b323a1cb879fd4e66530fbad07a32ee";
$API_SHARED_SECRET = "MWIzMjNhMWNiODc5ZmQ0ZTY2NTMwZmJhZDA3YTMyZWViOTQ3MDJiOGM2ZTU2NjE3"; // 公開しないでください
// salt, timestamp, signatureの生成
$salt = md5(mt_rand());
$timestamp = time();
$signature = base64_encode(hash_hmac('sha256', $salt.$timestamp, $API_SHARED_SECRET, true));
// key, salt, timestamp, signatureをGET変数に追加
$GET_VARS["timestamp"] = $timestamp; // UTCタイムスタンプ
$GET_VARS["salt"] = $salt;
$GET_VARS["key"] = $API_KEY_ID ; // APIキーID:これは公開されており、アプリケーションを識別するためにAPIによって使用されます
$GET_VARS["signature"] = $signature;
// リクエストURLを作成します。HTTPクエリを作成するためにPHPの組み込み関数を使用しない場合は、値をURLエンコードすることを忘れないでください。
$REQUEST_URL = $API_URL."?".http_build_query($GET_VARS);
// ".../api.php?go=api_subject&do=api_action&etc..."のようにURLを構築
// 新しいcURLリソースを作成して適切なオプションを設定
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $REQUEST_URL);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POST_VARS);
// PHPホストに有効なSSL証明書がない場合は、SSL証明書の検証を無効にする必要があります。これは危険であり、有効な証明書がインストールされるまで一時的に行われるべきです。
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Turns off verification of the SSL certificate.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Turns off verification of the SSL certificate.
// APIにリクエストを送信
$response = curl_exec($ch);
// レスポンス処理
if (!$response) {
echo 'API call failed';
}
else
{
print_r(json_decode($response,true));
}