Skip to end of metadata
Go to start of metadata

DELETE: Remove an Item document

A DELETE is pretty simple, although it does carry the requirement that the item must not have any children. To delete just set the Method to DELETE on whatever item you want to delete. You must also be logged in to delete items.

For example, in a REST client, specify URL:

https://www.sciencebase.gov/catalog/items

In body, list item ids for deletion:

 

[{
  "id": "50a8ff81e4b05de520e7a418" 
},
{
  "id": "50a8ff82e4b05de520e7a41c" 
},
{
  "id": "50a8ff82e4b05de520e7a420" 
},
{
  "id": "50a8ff82e4b05de520e7a426" 
}]

Using Natural Identifiers in DELETE requests

It is also possible to update a document using one of its natural identifiers (stored in the identifiers field of the item).  The only restriction is that the identifier you are using must be unique within the set of items that your user may update.  Otherwise, the REST api will return a 409 (Conflict) HTTP response for more than one matching item.

To use an item identifier for DELETE, you must not include a ScienceBase identifier in the URL.  You will simply use the http://www.sciencebase.gov/catalog/item/ base url and attach parameters representing the item identifier.  For example, http://www.sciencebase.gov/catalog/item/?scheme=CSC&type=id&key=108593.

In batch mode, using  http://www.sciencebase.gov/catalog/items/, you may also use natural identifiers rather than ScienceBase identifiers.  Note that you can mix and match both types.

[{
  "identifiers": [
    {
      scheme: "CSC",
      type: "id",
      key: "108593"
    }
  ]
},
{
  "id": "50a8ff82e4b05de520e7a426" 
}]


  • No labels