This package is used for accessing portal data from Icat Server.
Install the package
composer require ikoncept/ico8-api-wrapper
Publish the configuration
php artisan vendor:publish --provider="Ikoncept\Ico8\Ico8ServiceProvider"
Set the required environement variables
ICO8_PORTAL_HOST="http://ico8host.com/v1"
ICO8_PORTAL_API_KEY="API_KEY_HERE"
ICO8_PORTAL_ID="PORTAL_UUID"
ICO8_TENANT_ID='TENANT_UUID'
Import the Portal
client with typehinting
/**
* Display a listing of the resource.
*
* @param \Ikoncept\Ico8\Portal $portal
* @param \Illuminate\Http\Response $request
* @return \Illuminate\Support\Collection
*
*/
public function index(Portal $portal, Request $request) : Collection
{
$response = $portal->fetchPortalIco8(['limit' => 20]);
return $response;
}
Fetch portal media
$portal->fetchPortalIco8();
Fetch all related media to the specific portal
Optional parameters can be passed as below
$portal->fetchPortalIco8([
'limit' => 15 // Paginate media, showing 15 items per page
]);
Fetch portal information
$portal->fetchPortal()
Fetch portal info, for example the portal name
Search portal media
$portal->searchPortalIco8('searchQuery', ['limit' => 5]);
To filter the result the parameter array can be used.
Available filters for portalized media are:
filter[album]
filters media by album id
Example:
$response = $portal->fetchPortalIco8([
'limit' => 5,
'filter[album]' => 1,
])
To sort the parameter array is used.
Sortable fields are:
resolution
published_at
name
filesize
created_at
Example:
$response = $portal->fetchPortalIco8([
'sort' => '-name'
]);
Note; only published media will be fetched
Portals can be password protected to restrict access. Only a password is required to authenticate. If the password provided is correct it is up to the portal app to choose strategy to persist the authenticated state
Example:
$response = $portal->validatePassword('password');
If the password is incorrect a 401
response will be returned.