Difference between revisions of "API Collection Delete Asset"

From unroole CMS wiki
Jump to: navigation, search
Line 8: Line 8:
 
== HTTP Method ==
 
== HTTP Method ==
  
DELETE
+
DELETE / POST
  
 
== Required Paramaters ==
 
== Required Paramaters ==
Line 38: Line 38:
 
|}
 
|}
  
== Example Response ==
+
== 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>
 +
|}

Revision as of 09:56, 29 June 2012

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


Delete an item that is not in the collection

Paramater Value
token 1f0qpLwoV5oIcfnU2yvO
collection_item_id 99