PHP code example of mikkelson / shortcut-php
1. Go to this page and download the library: Download mikkelson/shortcut-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mikkelson / shortcut-php example snippets
use Mikkelson\Shortcut;
$token = '213901-dk9AJ-3SOJ-8dj9-KAAa0smsa';
$shortcut = new Shortcut($token);
$epic_id = '3000';
$epic = $shortcut->get('epics', $epic_id);
$epic_id = "4351";
$data = [
'description' => 'Keep your developers happy by providing detailed descriptions (-;',
'state' => 'to do'
];
$update = $shortcut->update('epics', $epic_id, $data);
$epic_id = '3000';
$shortcut->delete('epics', $epic_id);
$epics = $shortcut->get('epics');
$new_epic = [
'deadline' => '2020-08-16T12:30:00Z',
'name' => 'Terraforming of Mars',
'description' => 'Should be easy. Couple of astropeople, a trowel each. Easy.'
];
$epic = $shortcut->create('epics', $new_epic);
$file_id = '3000';
$file = $shortcut->get('files', $file_id);
$file_id = "4351";
$data = [
'description' => 'This file contains all of my most important passwords, in plain text.',
'name' => 'Paswords.txt'
];
$update = $shortcut->update('files', $file_id, $data);
$file_id = '3000';
$shortcut->delete('files', $file_id);
$files = $shortcut->get('files');
$new_label = [
'external_id' => 'thirdparty-id-123',
'name' => 'My New Label'
];
$label = $shortcut->create('labels', $new_label);
$label_id = "1234";
$data = [
'name' => 'Updated Label Name'
];
$label = $shortcut->update('labels', $label_id, $data);
$label_id = '3000';
$shortcut->delete('labels', $label_id);
$labels = $shortcut->get('labels');
$link_id = 5000;
$linked_files = $shortcut->get('linked-files', $link_id);
$new_link = [
'name' => 'My Linked File',
'description' => 'Description of the file',
'type' => 'dropbox',
'url' => 'http://dropbox.com/1sjsSA9Q/asd20j.txt
];
$linked_file = $shortcut->create('linked-files', $new_link);
$link_id = "1234";
$data = [
'name' => 'New name for linked file',
'description' => 'Description of new linked file'
];
$linked_file = $shortcut->update('linked-files', $link_id, $data);
$link_id = '3000';
$shortcut->delete('linked-files', $link_id);
$linked_files = $shortcut->get('linked-files');
$project_id = '2990';
$project = $shortcut->get('projects', $project_id);
$new_project = [
'name' => 'New Shortcut Project',
'description' => 'Description of the project',
'abbreviation' => 'ncp'
];
$project = $shortcut->create('projects', $new_project);
$project_id = 1234;
$data = [
'name' => 'New name for project',
'description' => 'Description update text'
];
$project = $shortcut->update('projects', $project_id, $data);
$project_id = 3000;
$shortcut->delete('projects', $project_id);
$projects = $shortcut->get('projects');
$new_link = [
'object_id' => 100,
'subject_id' => 250,
'verb' => 'blocks' //blocks, relates, duplicates
];
$story_links = $shortcut->create('story-links', $new_link);
$storylink_id = 3000;
$story_links = $shortcut->get('story-links', $storylink_id);
$storylink_id = 3000;
$shortcut->delete('story-links', $storylink_id);
$query = "state:500005001";
$stories = $shortcut->get('search/stories?query='.$query);
$new_story = [
'name' => 'New story with some tasks',
'project_id' => 6,
'story_type' => 'feature', //feature, chore, bug
'description' => 'Fuller descriptions make you more friends.',
'tasks' => [
['description' => 'Task description 1'],
['description' => 'Task description 2']
]
];
$story = $shortcut->create('stories', $new_story);
$story_id = 2000;
$story = $shortcut->get('stories', $story_id);
$story_id = 1234;
$data = [
'epic_id' => 29,
'description' => 'Description update text'
];
$story = $shortcut->update('stories', $story_id, $data);
$story_id = 300';
$shortcut->delete('stories', $story_id);
$users = $shortcut->get('users');
$user_id = '4JDaa9k-29d3-40s2-a4dc-a9bsd29sc';
$user = $shortcut->get('users', $user_id);
$workflows = $shortcut->get('workflows');
composer