Class PlaylistRestService

java.lang.Object
org.opencastproject.playlists.PlaylistRestService

@Path("/playlists") public class PlaylistRestService extends Object
A REST endpoint for the PlaylistService
  • Field Details

    • SAMPLE_PLAYLIST_JSON

      public static final String SAMPLE_PLAYLIST_JSON
      See Also:
    • SAMPLE_PLAYLIST_ENTRIES_JSON

      public static final String SAMPLE_PLAYLIST_ENTRIES_JSON
      See Also:
    • SAMPLE_PLAYLIST_XML

      public static final String SAMPLE_PLAYLIST_XML
      See Also:
    • SAMPLE_PLAYLIST_ENTRIES_XML

      public static final String SAMPLE_PLAYLIST_ENTRIES_XML
      See Also:
    • searchService

      protected org.opencastproject.search.api.SearchService searchService
      The search service
    • authorizationService

      protected org.opencastproject.security.api.AuthorizationService authorizationService
      The authorization service
  • Constructor Details

    • PlaylistRestService

      public PlaylistRestService()
  • Method Details

    • setService

      public void setService(PlaylistService service)
      Sets the playlist service
      Parameters:
      service - the playlist service instance
    • setSearchService

      protected void setSearchService(org.opencastproject.search.api.SearchService searchService)
    • setAuthorizationService

      public void setAuthorizationService(org.opencastproject.security.api.AuthorizationService authorizationService)
    • getPlaylistAsJson

      @GET @Produces("application/json") @Path("{id}.json") public javax.ws.rs.core.Response getPlaylistAsJson(@PathParam("id") String id, @FormParam("withPublications") boolean withPublications) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.security.api.UnauthorizedException
    • getPlaylistAsXml

      @GET @Produces("application/xml") @Path("{id}.xml") public javax.ws.rs.core.Response getPlaylistAsXml(@PathParam("id") String id, @FormParam("withPublications") boolean withPublications) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.security.api.UnauthorizedException
    • getPlaylistsAsJson

      @GET @Produces("application/json") @Path("playlists.json") public javax.ws.rs.core.Response getPlaylistsAsJson(@FormParam("limit") int limit, @FormParam("offset") int offset, @FormParam("sort") String sort) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • getPlaylistsAsXml

      @GET @Produces("application/xml") @Path("playlists.xml") public javax.ws.rs.core.Response getPlaylistsAsXml(@FormParam("limit") int limit, @FormParam("offset") int offset, @FormParam("sort") String sort) throws org.opencastproject.util.NotFoundException
      Throws:
      org.opencastproject.util.NotFoundException
    • createAsJson

      @POST @Produces("application/json") @Path("new.json") public javax.ws.rs.core.Response createAsJson(@FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.security.api.UnauthorizedException
    • createAsXml

      @POST @Produces("application/xml") @Path("new.xml") public javax.ws.rs.core.Response createAsXml(@FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.security.api.UnauthorizedException
    • updateAsJson

      @PUT @Produces("application/json") @Path("{id}.json") public javax.ws.rs.core.Response updateAsJson(@PathParam("id") String id, @FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.security.api.UnauthorizedException
    • updateAsXml

      @PUT @Produces("application/xml") @Path("{id}.xml") public javax.ws.rs.core.Response updateAsXml(@PathParam("id") String id, @FormParam("playlist") String playlistText) throws org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.security.api.UnauthorizedException
    • remove

      @DELETE @Produces("application/json") @Path("{id}") public javax.ws.rs.core.Response remove(@PathParam("id") String id) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.security.api.UnauthorizedException
    • addEntry

      @POST @Produces("application/json") @Path("{id}/entries/new") public javax.ws.rs.core.Response addEntry(@PathParam("id") String playlistId, @FormParam("contentId") String contentId, @FormParam("type") PlaylistEntryType type) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.security.api.UnauthorizedException
    • addEntry

      @POST @Produces("application/json") @Path("{id}/entries/{entryId}") public javax.ws.rs.core.Response addEntry(@PathParam("id") String playlistId, @PathParam("entryId") Long entryId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException
      Throws:
      org.opencastproject.util.NotFoundException
      org.opencastproject.security.api.UnauthorizedException
    • parseJsonToPlaylist

      public Playlist parseJsonToPlaylist(String json) throws org.json.simple.parser.ParseException, IOException
      While jackson takes care of automatically converting JAXB to JSON when returning from a request, getting it to parse JSON to JAXB when accepting a request is not that automatic. This functions takes care of that.
      Parameters:
      json - Valid JSON as a string
      Returns:
      A Playlist containing the information from the JSON
      Throws:
      org.json.simple.parser.ParseException
      IOException