Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Albums: Working with album members

Natasa Bulatovic edited this page Jul 9, 2015 · 9 revisions

##GET /albums/:id/members

  • Retrieves a list of album members (items) accessible to the user (authorization optional).

####Response status codes

  • 200 OK Successful GET and a list of items contains at least one item
  • 404 Not Found Album with provided id does not exist

####Example request *All members

curl http://<base-url-rest-api>/albums/YgzeK4cLp5LTpA_9/members

*Members filtered by a query

curl http://<base-url-rest-api>/albums/YgzeK4cLp5LTpA_9/members?q=test

####Example Response JSON Formatted list of items, see Retrieve list of items example

##DELETE /albums/:id/members

  • Removes all album members from an Album

####Response status codes

  • 204 No Content Successful Delete no content is returned
  • 404 Not Found Album with provided id does not exist
  • 422 Unprocessable Entity Album must not be empty when it is released

####Example request

curl -X "DELETE" http://<base-url-rest-api>/albums/YgzeK4cLp5LTpA_9/members ####Example response

  • no content is return in the response (204)

##PUT /albums/:id/members/link

  • links items provided in the message body to an Album

####Response status codes

  • 404 Not Found Album with provided id does not exist or item referenced in the message body does not exist
  • 422 Unprocessable Entity e.g. Album is discarded, members can not be added
  • 200 OK Successful addition of new album members

####Example request

curl --user admin:admin \
   --header "Content-Type:application/json" \
   --header "Accept: application/json" \
   --request PUT\
   --data '["Item-id1", "Item-id2", "Item-id3"]' \
   http://<baseurl>/albums/<albumid>/members/link

####Example response In case of successfull linking (response code 200), list of identifiers of Album items is returned

[
 "FJW4Cev83SWBZeW",
 "LcWVufyR7sGNPTVe",
 "inGiwtAC9jKUuilJ"
 ]

##PUT /albums/:id/members/unlink

  • removes items provided in the message body from Album with provided :id

####Response status codes

  • 404 Not Found Album with provided id does not exist or item referenced in the message body does not exist
  • 204 No Content Successful removal of album members, no content is returned

####Example request

curl --user admin:admin \
   --header "Content-Type:application/json" \
   --header "Accept: application/json" \
   --request PUT\
   --data '["Item-id1", "Item-id2"]' \
   http://<baseurl>/albums/<albumid>/members/unlink
Clone this wiki locally