Difference between revisions of "API Collection Delete Asset"
Tommy.leung (Talk | contribs) (→URI) |
Tommy.leung (Talk | contribs) |
||
(2 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
== URI == | == URI == | ||
− | {{:API_Base_URI}} | + | {{:API_Base_URI}}collections/[collection-id]/delete_item |
== HTTP Method == | == HTTP Method == | ||
− | DELETE | + | DELETE / POST |
== Required Paramaters == | == Required Paramaters == | ||
Line 25: | Line 25: | ||
| | | | ||
| | | | ||
− | | This is the id of the collection item, not the id of the item itself. | + | | This is the id of the collection item, not the id of the item itself. Refer to [[:API_Collection_Fields]] for the id of each item in the collection. |
|} | |} | ||
Line 38: | Line 38: | ||
|} | |} | ||
− | == | + | == Examples == |
+ | |||
+ | ''these example require jQuery'' | ||
+ | |||
+ | === Delete an item in the collection === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Paramater | ||
+ | ! Value | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | collection_item_id | ||
+ | | 20 | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! jQuery ajax call | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | $.ajax('http://api.win-tommy.com:3000/collections/1/delete_item?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: { | ||
+ | collection_item_id: 20 | ||
+ | } | ||
+ | }); | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | {"http_status":200} | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <hash> | ||
+ | <http-status type="integer">200</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | === Delete an item that is not in the collection === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Paramater | ||
+ | ! Value | ||
+ | |- | ||
+ | | token | ||
+ | | 1f0qpLwoV5oIcfnU2yvO | ||
+ | |- | ||
+ | | collection_item_id | ||
+ | | 99 | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! jQuery ajax call | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <nowiki> | ||
+ | $.ajax('http://api.unroole.com/collections/1/delete_item?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: { | ||
+ | collection_item_id: 99 | ||
+ | } | ||
+ | }); | ||
+ | </nowiki> | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! JSON | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | {"error":"No such resource","http_status":412} | ||
+ | </blockquote> | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable collapsible collapsed" | ||
+ | |- | ||
+ | ! XML | ||
+ | |- | ||
+ | | <blockquote> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <hash> | ||
+ | <error>No such resource</error> | ||
+ | <http-status type="integer">412</http-status> | ||
+ | </hash> | ||
+ | </blockquote> | ||
+ | |} |
Latest revision as of 09:10, 3 July 2012
Contents
Summary
Allows for deleting an asset from the collection.
URI
https://api.unroole.com/collections/[collection-id]/delete_item
HTTP Method
DELETE / POST
Required Paramaters
Paramater | Default | Maximum Length | Accepted Values | Description |
---|---|---|---|---|
token | API Persistence Token that identifies this user and its permissions. | |||
collection_item_id | This is the id of the collection item, not the id of the item itself. Refer to API_Collection_Fields for the id of each item in the collection. |
Response
Field | Type | Description |
---|---|---|
http_status | integer | API Status Code http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
error | Rails default |
Examples
these example require jQuery
Delete an item in the collection
Paramater | Value |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
collection_item_id | 20 |
jQuery ajax call |
---|
|
JSON |
---|
|
XML |
---|
|
Delete an item that is not in the collection
Paramater | Value |
---|---|
token | 1f0qpLwoV5oIcfnU2yvO |
collection_item_id | 99 |
jQuery ajax call |
---|
|
JSON |
---|
|
XML |
---|
|