API編

5-03.ユーザーの編集

ユーザーの編集についてご説明します。

1.概要

※開発言語はPHPを前提としています。

2.リクエストURL

【POST】https://api.edulio.com/members/edit/{unique_id}

3.cURLを用いたユーザー登録のサンプルコード


$post = array(
 'unique_id' => 'apitest',
 'name' => 'APIユーザー',
 'password_edit_skip' => 1,
 'password' => 'test1234',
 'password_edit_skip' => 1,
 'entry_date' => '2017-05-01',
 'time_limit' => '2018-03-31',
 'memo' => 'フリーメモ',
 'open_id' => 'open-id',
 'group' => array(
   'マスタ1' => 'グループ1',
   'マスタ2' => 'グループ2',
 ),
);
$accessToken = '取得したトークン';
$url = 'https://api-dev.edulio.com/members/add';

$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: '.$accessToken));
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$result = curl_exec($ch);
curl_close($ch);


4.ライブラリを用いたサンプルコード

$post = array(            
 'unique_id' => 'apitestedit',            
 'name' => 'APIユーザー',            
 'email' => 'test@edulio.com',            
 'password_edit_skip' => 1,            
 'lerning_flg' => 1,            
 'memo' => 'フリーメモ',            
 'open_id' => 'open-id',            
 'group' => array(            
   'マスタ1' => 'グループ1',            
   'マスタ2' => 'グループ2',            
 ),            
);            
$accessToken = '取得したトークン';            
$unique_id = 'apitest';            
$url = 'https://api-dev.edulio.com/members/edit/'.$unique_id;            
           
$ch = curl_init();            
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');            
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);            
curl_setopt($ch, CURLOPT_URL, $url);            
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);            
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: '.$accessToken));            
curl_setopt($ch, CURLOPT_POST, TRUE);            
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));            
$result = curl_exec($ch);            
curl_close($ch);