PATCH

/api/v1/accounts/update_credentials

Request Code

Last Update : 2019.07.08
// set request
$request = new \MastodonApi\Accounts\UpdateCredentialsRequest();

// set display_name
$request->display_name = '{display_name}';

// set note
$request->note = '{note}';

// set avatar image file
if (isset($_FILES['avatar'], $_FILES['avatar']['error']) && $_FILES['avatar']['error'] === 0)
{
	$request->avatar = new \CURLFile($_FILES['avatar']['tmp_name'], $_FILES['avatar']['type'], 'avatar');
}

// set header image file
if (isset($_FILES['header'], $_FILES['header']['error']) && $_FILES['header']['error'] === 0)
{
	$request->header = new \CURLFile($_FILES['header']['tmp_name'], $_FILES['header']['type'], 'header');
}

// set locked
$request->locked = '{locked}';

// set source - privacy
$request->source->privacy = '{source[privacy]}';

// set source - sensitive
$request->source->sensitive = '{source[sensitive]}';

// set source - language
$request->source->language = '{source[language]}';

// set fields_attributes
$request->fields_attributes[0]->name = '{fields_attributes[0][name]}';
$request->fields_attributes[0]->value= '{fields_attributes[0][value]}';

$request->fields_attributes[1]->name = '{fields_attributes[1][name]}';
$request->fields_attributes[1]->value= '{fields_attributes[1][value]}';

$request->fields_attributes[2]->name = '{fields_attributes[2][name]}';
$request->fields_attributes[2]->value= '{fields_attributes[2][value]}';

$request->fields_attributes[3]->name = '{fields_attributes[3][name]}';
$request->fields_attributes[3]->value= '{fields_attributes[3][value]}';

// update account data
$mastodonApi->accounts->updateCredentials($request);

Response Data

Last Update : 2019.07.06
MastodonApi\Entities\Account Object
(
	[id] => {Account Id}
	[username] => {Account Username}
	[acct] => {Account acct}
	[display_name] => {Account Display Name}
	[locked] => {Account Locked}
	[bot] => {Account Bot}
	[created_at] => {Account Created At ISO 8601}
	[note] => {Account Note}
	[url] => {Account Url}
	[avatar] => {Account Avatar}
	[avatar_static] => {Account Avatar Static}
	[header] => {Account Header}
	[header_static] => {Account Header Static}
	[followers_count] => {Account Followers}
	[following_count] => {Account Following}
	[statuses_count] => {Account Statuses Count}
	[source] => MastodonApi\Entities\Source Object
	(
		[privacy] => {Account Source Privacy}
		[sensitive] => {Account Source Sensitive}
		[language] => {Account Source Language}
		[note] => {Account Source Note}
		[fields] => Array
		(
			[0] => MastodonApi\Entities\AccountField Object
			(
				[name] => {Account Field Name}
				[value] => {Account Field Value}
				[verified_at] => {Account Field Verified At}
			)
		)
	)
	[emojis] => Array
	(
	)
	[fields] => Array
	(
		[0] => MastodonApi\Entities\AccountField Object
		(
			[name] => {Account Field Name}
			[value] => {Account Field Value}
			[verified_at] => {Account Field Verified At}
		)
	)
)
id string
username string
acct string
display_name string
locked bool
bot bool
created_at string (ISO 8601)
note string
url string
avatar string
avatar_static string
header string
header_static string
followers_count int
following_count int
statuses_count int
source MastodonApi\Entities\AccountSource
emojis array
fields array

AdSense