2017 © Pedro Peláez
 

library imagerelay-php

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

image

imagerelay/imagerelay-php

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  • Wednesday, April 20, 2016
  • by ImageRelay
  • Repository
  • 9 Watchers
  • 2 Stars
  • 41 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 8 % Grown

The README.md

Image Relay API PHP Library

If you would like to contribute to the project please fork the repo and create a pull request with your work. Documentation will be updated as end points are added., (*1)

Installation

We recommend using composer to manage dependencies and installation of the Image Relay API PHP library. If you are unfamiliar with composer you can read about installation into your application here - Composer Install How To, (*2)

Run the following command from your console
    $ php composer.phar require imagerelay/imagerelay-php

Usage

To use the library you only need to have an Image Relay account with proper permissions to complete the API actions. You will need to require once the vender/autoload.php file provided by composer., (*3)

Authorization with username and password

Don't forget to change imagerelay_url to use your own subdomain or custom url., (*4)

 'subdomain.imagerelay.com',
        'auth' => 'http',
        'username' => 'username',
        'password' => 'password',
        'app_name' => 'Sample APP',
        'app_contact' => 'http://www.sampleapp.com',
    ));
?>
Authorization with oAuth

When authorizing with oauth you will need to use one of the many existing libraries available to retrieve your oauth access token. The Image Relay API adheres to oauth standars for authentication., (*5)

Don't forget to change imagerelay_url to use your own subdomain or custom url., (*6)

 'subdomain.imagerelay.com',
        'auth' => 'oauth',
        'token' => '08dfsafd8asdf8asdf90as8df90df8',
        'app_name' => 'Sample APP',
        'app_contact' => 'http://www.sampleapp.com',
    ));
?>

Files

Image Relay API: Files, (*7)

Get Files from Folder
    $response = $client->getFiles( array(
        'folder_id' => 8363117,
        'page' => 2,
    ));
Get File
    $response = $client->getFile( array(
        'id' => 8363117,
    ));
Upload File from URL
    $response = $client->uploadFileFromURL( array(
        'filename' => 'test.jpg',
        'folder_id' => 285356,
        'file_type_id' => 1464,
        'terms' => array(
            'term_id' => '145',
            'value' => 'Test Value',
        ),
        'url' => 'https://upload.wikimedia.org/wikipedia/commons/5/55/Atelopus_zeteki1.jpg'
    ));

Folders

Image Relay API: Folders, (*8)

Get Folders
Top Level Folders
$response = $client->getFolders('page' => 1);
Children of Parent Folder
$response = $client->getChildFolders( array(
    'folder_id' => 191678,
    'page' => 1
));
Root Folder
$response = $client->getRootFolder();
Get Folder
$response = $client->getFolder( array(
    'folder_id' => 191678,
));
Create Folder
$response = $client->createFolder( array(
    'folder_id' => 191678,
    'name' => 'Testing Folder Create',
));
Update Folder
$response = $client->updateFolder( array(
    'folder_id' => 290503,
    'name' => 'New Folder Create',
));

File Types

Image Relay API: File Types, (*9)

Get File Types
$response = $client->getFileTypes();
Get File Type
$response = $client->getFileType( array(
    'id' => 290503,
));

Image Relay API: Folder Links, (*10)

$response = $client->getFolderLinks( array(
    'page' => 2,
));
$response = $client->getFolderLink( array(
    'id' => 290503,
));
$response = $client->createFolderLink( array(
    'folder_id' => 290503,
    'allows_download' => true,
    'expires_on' => '2015-07-15',
    'show_tracking' => true,
    'purpose' => 'Download for spring catalog images',
));
$response = $client->deleteFolderLink( array(
    'id' => 290503,
));

Invited Users

Image Relay API: Invited Users, (*11)

Get Invited Users
$response = $client->getInvitedUsers( array(
    'page' => 2,
));
Get Invited User
$response = $client->getInvitedUser( array(
    'id' => 290503,
));
Invite New User
$response = $client->inviteNewUser( array(
    'first_name' => 'First Name',
    'last_name' => 'Last Name',
    'email' => 'example@imagerelay.com',
    'company' => 'Image Relay',
    'permission_id' => 167,
));
Delete Invited User
$response = $client->deleteInvitedUser( array(
    'id' => 290503,
));

Permissions

Image Relay API: Permissions, (*12)

Get Permissions
$response = $client->getPermissions( array(
    'page' => 2,
));
Get Permission
$response = $client->getPermission( array(
    'id' => 290503,
));

Image Relay API: Quick Links, (*13)

$response = $client->getQuickLinks( array(
    'page' => 2,
));
$response = $client->getQuickLink( array(
    'id' => 290503,
));
$response = $client->createQuickLink( array(
    'asset_id' => 290503,
    'purpose' => 'Download for spring catalog images',
));
$response = $client->deleteQuickLink( array(
    'id' => 290503,
));

Image Relay API: Upload Links, (*14)

$response = $client->getUploadLinks( array(
    'page' => 2,
));
$response = $client->getUploadLink( array(
    'id' => 290503,
));
$response = $client->createUploadLink( array(
    'folder_id' => 290503,
    'purpose' => 'Upload location for spring catalog images',
));
$response = $client->deleteUploadLink( array(
    'id' => 290503,
));

Users

Image Relay API: Users, (*15)

Get Users
$response = $client->getUsers( array(
    'page' => 2,
));
Get User
$response = $client->getUser( array(
    'id' => 290503,
));

Webhooks

Image Relay API: Webhooks, (*16)

Get Webhooks
$response = $client->getWebhooks();
Get Webhook
$response = $client->getWebhook( array(
    'id' => 290503,
));
Create Webhook
$response = $client->createWebhook( array(
    'resource' => 'file',
    'action' => 'created',
    'url' => 'https://www.example.com'
));
$response = $client->deleteWebhook( array(
    'id' => 290503,
));
Supported Webhooks
$response = $client->getSupportedWebhooks();

KEYWORDING

Image Relay API: Keywording, (*17)

Keyword Sets

Get Keyword Sets
$response = $client->getKeywordSets( array(
    'page' => 2,
));
Get KeywordSet
$response = $client->getKeywordSet( array(
    'id' => 290503,
));
Create KeywordSet
$response = $client->createKeywordSet( array(
    'name' => 'Sample Keyword Set name',
));
Update KeywordSet
$response = $client->updateKeywordSet( array(
    'id' = > 244244,
    'name' => 'Sample Keyword Set name',
));
Delete Keyword Set
$response = $client->deleteKeywordSet( array(
    'id' => 290503,
));

Keywords

Get Keywords
$response = $client->getKeywords( array(
    'keyword_set_id' => 2522,
));
Get Keyword
$response = $client->getKeyword( array(
    'keyword_set_id' => 290503,
    'keyword_id' => 22323,
));
Create Keyword
$response = $client->createKeyword( array(
    'keyword_set_id' => 22422,
    'name' => 'Sample Keyword Set name',
));
Update Keyword
$response = $client->updateKeyword( array(
    'keyword_set_id' => 32454,
    'keyword_id' => 23224,
    'name' => 'Sample Keyword Set name',
));
Delete Keyword
$response = $client->deleteKeyword( array(
    'keyword_set_id' => 290503,
    'keyword_id' => 21424,
));

Uploads

Image Relay API: Uploads, (*18)

createUploadJob
$uploadJob = $client->createUploadJob( array(
    'folder_id' => 291692,
    'file_type_id' => 1464,
    'files' => array ( array (
        'name' => 'two_frogs.jpg',
        'size' => filesize($_SERVER['DOCUMENT_ROOT'].'/two_frogs.jpg')
        )
    ),
    'terms' => array ( array (
        'term_id' => '5802',
        'value' => 'Testing 123'
        )
    ),
));
createFileChunk
$upload = $client->createFileChunk( array(
    'upload_job_id' => $uploadJob['id'],
    'file_id' => $uploadJob['files'][0]['id'],
    'chunk_id' => 1,
    'mimeType' => 'application/octet-stream',
    'data' => file_get_contents($_SERVER['DOCUMENT_ROOT'].'/two_frogs.jpg'),
));

The Versions

20/04 2016

dev-master

9999999-dev http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

20/04 2016

1.1.5

1.1.5.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

20/04 2016

1.1.4

1.1.4.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

15/07 2015

1.1.3

1.1.3.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

15/07 2015

1.1.2

1.1.2.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

14/07 2015

1.1.1

1.1.1.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

14/07 2015

1.1.0

1.1.0.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Mathis

api imagerelay

13/07 2015

1.0.0

1.0.0.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

by Travis Mathis

api imagerelay

13/07 2015

0.3.0

0.3.0.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

by Travis Mathis

api imagerelay

13/07 2015

0.2.0

0.2.0.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

by Travis Mathis

api imagerelay

10/07 2015

0.1.0

0.1.0.0 http://www.imagerelay.com

The Image Relay PHP Library makes it easy for developers to leverage the Image Relay API in their applications.

  Sources   Download

MIT

The Requires

 

by Travis Mathis

api imagerelay