Difference between revisions of "API Collection Add Asset"
Tommy.leung (Talk | contribs) (Created page with "== Summary == Allows for adding an asset to the collection. == URI == http://[channel_subdomain]-[account_subdomain].unroole.com/unroole/admin/sorted_playlists/[playlist_id...") |
Tommy.leung (Talk | contribs) (→Add to the collection) |
||
(6 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
== URI == | == URI == | ||
− | + | {{:API_Base_URI}}collections/[collection-id]/add_items | |
− | + | ||
− | + | ||
− | + | ||
== HTTP Method == | == HTTP Method == | ||
Line 40: | Line 37: | ||
! Description | ! Description | ||
|- | |- | ||
− | | | + | | item_ids[] |
| | | | ||
| | | | ||
− | | Each item must be in the format [ | + | | Each item must be in the format [page OR asset]_[item-id] <br /> e.g. asset_18, page_232, asset_54 |
− | | Array of | + | | Array of item ids to add to the collection. |
|} | |} | ||
Line 54: | Line 51: | ||
! Type | ! Type | ||
! Description | ! Description | ||
− | + | {{:API Response Common}} | |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
| success_items | | success_items | ||
− | | array of | + | | array of ids |
− | | List of | + | | List of item_ids that were successfully added to the collection |
|- | |- | ||
| failed_items | | failed_items | ||
− | | array of | + | | array of ids |
− | | List of | + | | List of item_ids that failed to be added to the collection |
+ | |} | ||
+ | == Examples == | ||
+ | |||
+ | ''these example require jQuery'' | ||
+ | |||
+ | === Add to the collection === | ||
+ | |||
+ | This user does not have access to page_2, asset_304, and asset_305 | ||
+ | |||
+ | {| class="wikitable" | ||
|- | |- | ||
− | | | + | ! Paramater |
− | | | + | ! Value |
− | | | + | |- |
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | item_ids[] | ||
+ | | ['page_2', 'page_3', 'asset_303', 'asset_304', 'asset_305'] | ||
|} | |} | ||
− | == | + | {| class="wikitable collapsible collapsed" |
+ | |- | ||
+ | ! jQuery ajax call | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | $.ajax('http://api.unroole.com/collections/1/add_items?token=1f0qpLwoV5oIcfnU2yvO', { | ||
+ | headers: { | ||
+ | // use below for json request | ||
+ | Accept : "application/json, text/javascript" | ||
+ | // use below for xml request | ||
+ | //Accept : "text/html,application/xhtml+xml,application/xml" | ||
+ | }, | ||
+ | type: 'POST', | ||
+ | data: { | ||
+ | item_ids: ['page_2', 'page_3', 'asset_303', 'asset_304', 'asset_305'] | ||
+ | } | ||
+ | }); | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | {"success_items":["page_3","asset_303"],"failed_items":["page_2","asset_304","asset_305"],"http_status":200} | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <hash> | ||
+ | <success-items type="array"> | ||
+ | <success-item>page_3</success-item> | ||
+ | <success-item>asset_303</success-item> | ||
+ | </success-items> | ||
+ | <failed-items type="array"> | ||
+ | <failed-item>page_2</failed-item> | ||
+ | <failed-item>asset_304</failed-item> | ||
+ | <failed-item>asset_305</failed-item> | ||
+ | </failed-items> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash>tatus type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} |
Latest revision as of 09:47, 29 June 2012
Contents
Summary
Allows for adding an asset to the collection.
URI
https://api.unroole.com/collections/[collection-id]/add_items
HTTP Method
POST
Required Paramaters
Paramater | Default | Maximum Length | Accepted Values | Description |
---|---|---|---|---|
token | API Persistence Token that identifies this user and its permissions. |
Optional Paramaters
Paramater | Default | Maximum Length | Accepted Values | Description |
---|---|---|---|---|
item_ids[] | Each item must be in the format [page OR asset]_[item-id] e.g. asset_18, page_232, asset_54 |
Array of item ids to add to the collection. |
Response
Field | Type | Description |
---|---|---|
http_status | integer | API Status Code http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
error | Rails default | |
success_items | array of ids | List of item_ids that were successfully added to the collection |
failed_items | array of ids | List of item_ids that failed to be added to the collection |
Examples
these example require jQuery
Add to the collection
This user does not have access to page_2, asset_304, and asset_305
Paramater | Value |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
item_ids[] | ['page_2', 'page_3', 'asset_303', 'asset_304', 'asset_305'] |
jQuery ajax call |
---|
|
JSON |
---|
|
XML |
---|
|