Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit a4bbd06

Browse files
author
Jamie Snape
committed
Add old style API call for creating link and tweak name of new style call
1 parent 7868492 commit a4bbd06

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

core/controllers/api/SystemController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function postAction()
7575
'default' => 'adminDatabaseCleanup',
7676
'databasecleanup' => 'adminDatabaseCleanup',
7777
'defaultapikey' => 'userApikeyDefault',
78-
'createlink' => 'linkCreate',
78+
'link' => 'linkCreate',
7979
'upload' => 'uploadPerform'
8080
);
8181
$this->_genericAction($this->_request->getParams(), $this->_request->getControllerName(), 'post', $apiFunctions);

core/controllers/components/ApisystemComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function userApikeyDefault($args)
198198

199199
/**
200200
* Create a link bitstream. POST is required.
201-
* @path /system/createlink
201+
* @path /system/link
202202
* @http POST
203203
* @param useSession (Optional) Authenticate using the current Midas session
204204
* @param token (Optional) Authentication token

modules/api/controllers/components/ApiComponent.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,30 @@ function resourceSearch($args)
283283
return $searchComponent->searchAll($userDao, $args['search'], $order);
284284
}
285285

286+
/**
287+
* Create a link bitstream.
288+
* @param token Authentication token.
289+
* @param folderid
290+
The id of the folder in which to create a new item that will
291+
contain the link. The new item will have the same name as
292+
<b>url</b> unless <b>itemname</b> is supplied.
293+
* @param url The URL of the link you will create, will be used as the name
294+
of the bitstream and of the item (unless <b>itemname</b> is
295+
supplied).
296+
* @param itemname (Optional)
297+
The name of the newly created item, if not supplied, the item will
298+
have the same name as <b>url</b>.
299+
* @param length (Optional)
300+
The length in bytes of the file to which the link points.
301+
* @param checksum (Optional)
302+
The md5 checksum of the file to which the link points.
303+
* @return The item information of the item created.
304+
*/
305+
function linkCreate($args)
306+
{
307+
return $this->_callCoreApiMethod($args, 'linkCreate', 'system');
308+
}
309+
286310
/**
287311
* Generate a unique upload token. Either <b>itemid</b> or <b>folderid</b> is required,
288312
but both are not allowed.

0 commit comments

Comments
 (0)