POST

/api/v1/media

Request Code

Last Update : 2019.07.15
// set request
$request = new \MastodonApi\Media\PostRequest();
$request->description = '{description}';
$request->focus = '{focus}';

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

$mastodonApi->media->post($request);

Response Data

Last Update : 2019.07.15
MastodonApi\Entities\Attachment Object
(
	[id] => {id}
	[type] => {type}
	[url] => {url}
	[remote_url] => {remote_url}
	[preview_url] => {preview_url}
	[text_url] => {text_url}
	[meta] => Array
	(
		[original] => MastodonApi\Entities\AttachmentHash Object
		(
			[width] => {width}
			[height] => {height}
			[size] => {size}
			[aspect] => {aspect}
		)
		[small] => MastodonApi\Entities\AttachmentHash Object
		(
			[width] => {width}
			[height] => {height}
			[size] => {size}
			[aspect] => {aspect}
		)
	)
	[description] => {description}
	[blurhash] => {blurhash}
)
id string
type string
url string
remote_url string
preview_url string
text_url string
meta array
description string
blurhash string

AdSense