[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_media/src/Controller/ -> ApiController.php (summary)

(no description)

Copyright: (C) 2017 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 398 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ApiController:: (10 methods):
  execute()
  getFiles()
  deleteFiles()
  postFiles()
  putFiles()
  sendResponse()
  getModel()
  checkContent()
  getAdapter()
  getPath()


Class: ApiController  - X-Ref

Api Media Controller

This is NO public api controller, it is internal for the com_media component only!

execute($task)   X-Ref
Execute a task by triggering a method in the derived class.

param: string  $task  The task to perform. If no matching task is found, the '__default' task is executed, if defined.
return: mixed   The value returned by the called method.

getFiles()   X-Ref
Files Get Method

Examples:

- GET a list of folders below the root:
index.php?option=com_media&task=api.files
/api/files
- GET a list of files and subfolders of a given folder:
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia
/api/files/sampledata/cassiopeia
- GET a list of files and subfolders of a given folder for a given search term:
use recursive=1 to search recursively in the working directory
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5
/api/files/sampledata/cassiopeia?search=nasa5
To look up in same working directory set flag recursive=0
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia&search=nasa5&recursive=0
/api/files/sampledata/cassiopeia?search=nasa5&recursive=0
- GET file information for a specific file:
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
/api/files/sampledata/cassiopeia/test.jpg
- GET a temporary URL to a given file
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1&temp=1
/api/files/sampledata/cassiopeia/test.jpg&url=1&temp=1
- GET a temporary URL to a given file
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg&url=1
/api/files/sampledata/cassiopeia/test.jpg&url=1

return: array  The data to send with the response

deleteFiles()   X-Ref
Files delete Method

Examples:

- DELETE an existing folder in a specific folder:
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test
/api/files/sampledata/cassiopeia/test
- DELETE an existing file in a specific folder:
index.php?option=com_media&task=api.files&path=/sampledata/cassiopeia/test.jpg
/api/files/sampledata/cassiopeia/test.jpg

return: null

postFiles()   X-Ref
Files Post Method

Examples:

- POST a new file or folder into a specific folder, the file or folder information is returned:
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia
/api/files/sampledata/cassiopeia

New file body:
{
"name": "test.jpg",
"content":"base64 encoded image"
}
New folder body:
{
"name": "test",
}

return: array  The data to send with the response

putFiles()   X-Ref
Files Put method

Examples:

- PUT a media file, the file or folder information is returned:
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
/api/files/sampledata/cassiopeia/test.jpg

Update file body:
{
"content":"base64 encoded image"
}

- PUT move a file, folder to another one
path : will be taken as the source
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
/api/files/sampledata/cassiopeia/test.jpg

JSON body:
{
"newPath" : "/path/to/destination",
"move"    : "1"
}

- PUT copy a file, folder to another one
path : will be taken as the source
index.php?option=com_media&task=api.files&format=json&path=/sampledata/cassiopeia/test.jpg
/api/files/sampledata/cassiopeia/test.jpg

JSON body:
{
"newPath" : "/path/to/destination",
"move"    : "0"
}

return: array  The data to send with the response

sendResponse($data = null, int $responseCode = 200)   X-Ref
Send the given data as JSON response in the following format:

{"success":true,"message":"ok","messages":null,"data":[{"type":"dir","name":"banners","path":"//"}]}

param: mixed    $data          The data to send
param: integer  $responseCode  The response code
return: void

getModel($name = 'Api', $prefix = 'Administrator', $config = [])   X-Ref
Method to get a model object, loading it if required.

param: string  $name    The model name. Optional.
param: string  $prefix  The class prefix. Optional.
param: array   $config  Configuration array for model. Optional.
return: BaseModel|boolean  Model object on success; otherwise false on failure.

checkContent()   X-Ref
Performs various checks if it is allowed to save the content.

return: void

getAdapter()   X-Ref
Get the Adapter.

return: string

getPath()   X-Ref
Get the Path.

return: string



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer