2017 © Pedro Peláez
 

library sdk

Api to call sortechs website.

image

sortechs/sdk

Api to call sortechs website.

  • Sunday, February 4, 2018
  • by salahat
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sortechs SDK for PHP (v0.1)

This repository contains the open source PHP SDK that allows you to access the Sortechs automation app from your PHP app., (*1)

Installation

The Sortechs PHP SDK can be installed with Composer. Run this command:, (*2)

composer require sortechs/sdk

Examples

Add News

require_once '../src/Sortechs/autoload.php';

$data = [
    'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$section = $so->getSections($token);

$news = $so->app->news([
     'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api *Required or sectionName
    'sectionName'=>'News',//*Required or sectionId
    'title'=>'XXXX XXXX ',//*Required
    'article'=>'XXX XXX - XXX',//*Required
    'url'=>'https://www.XXXX.com/news.html?id=XXXXXXXX',//*Required
    'newsId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', /*id from your DATABASE , Like 1000  *Required */
    'options'=>[] /* Optional*/
]);

$response = $so->AddNews($token,$news);
print_r($response);

Add news with media

require_once '../src/Sortechs/autoload.php';

$data = [
    'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];

/**@var $so \Sortechs\Sortechs **/

$so = new \Sortechs\Sortechs($data);

$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());

/** video */

/*$media = $so->app->media([
    [
        'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.mp4',
        'caption'=>null,
        'type'=>'video'
    ]
]);*/

$media = $so->app->media([
    [
        'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
        'caption'=>null,
        'type'=>'image'
    ],
    [
        'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
        'caption'=>null,
        'type'=>'image'
    ],
    [
        'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
        'caption'=>null,
        'type'=>'image'
    ]
]);
$news = $so->app->news([
     'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api *Required or sectionName
    'sectionName'=>'News',//*Required or sectionId
    'title'=>'XXXX XXXX ',//*Required
    'article'=>'XXX XXX - XXX',//*Required
    'url'=>'https://www.XXXX.com/news.html?id=XXXXXXXX',//*Required
    'newsId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', /*id from your DATABASE , Like 1000  *Required */
    'options'=>[] /* Optional*/
]);
$response = $so->AddNewsWithMedia($token,$news,$media);

Add section

$data = [
    'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$data_section = new \Sortechs\request\Section(['title'=>'XXXX']);
$data = $so->addSection($token,$data_section);

Add tags

require_once '../src/Sortechs/autoload.php';
$data = [
    'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$tags = $so->app->tags([
    //'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api
    'sectionName'=>'News',
    'tags'=>[
        'tag',
        'tag X',
        'tag X',
        'tag X',
    ]
]);
$response = $so->AddTags($token,$tags);

Complete examples are available here., (*3)

The Versions

04/02 2018

dev-master

9999999-dev

Api to call sortechs website.

  Sources   Download

Sortechs

The Requires

  • php *

 

by Mohammad Salahat

facebook instagram twitter automation sortechs