# Media (*media()*) ## Overview API Calls interacting with Plex Media Server Media ### Available Operations * [markPlayed](#markplayed) - Mark Media Played * [markUnplayed](#markunplayed) - Mark Media Unplayed * [updatePlayProgress](#updateplayprogress) - Update Media Play Progress ## markPlayed This will mark the provided media key as Played. ### Example Usage ```java package hello.world; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import lukehagar.plexapi.plexapi.PlexAPI; import lukehagar.plexapi.plexapi.models.operations.*; import lukehagar.plexapi.plexapi.models.shared.*; import lukehagar.plexapi.plexapi.models.shared.Security; import lukehagar.plexapi.plexapi.utils.EventStream; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { PlexAPI sdk = PlexAPI.builder() .accessToken("") .xPlexClientIdentifier("Postman") .build(); MarkPlayedResponse res = sdk.media().markPlayed() .key(59398d) .call(); // handle response } catch (lukehagar.plexapi.plexapi.models.errors.MarkPlayedResponseBody e) { // handle exception throw e; } catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | | `key` | *double* | :heavy_check_mark: | The media key to mark as played | 59398 | ### Response **[lukehagar.plexapi.plexapi.models.operations.MarkPlayedResponse](../../models/operations/MarkPlayedResponse.md)** ### Errors | Error Object | Status Code | Content Type | | ------------------------------------ | ------------------------------------ | ------------------------------------ | | models/errors/MarkPlayedResponseBody | 401 | application/json | | models/errors/SDKError | 4xx-5xx | \*\/* | ## markUnplayed This will mark the provided media key as Unplayed. ### Example Usage ```java package hello.world; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import lukehagar.plexapi.plexapi.PlexAPI; import lukehagar.plexapi.plexapi.models.operations.*; import lukehagar.plexapi.plexapi.models.shared.*; import lukehagar.plexapi.plexapi.models.shared.Security; import lukehagar.plexapi.plexapi.utils.EventStream; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { PlexAPI sdk = PlexAPI.builder() .accessToken("") .xPlexClientIdentifier("Postman") .build(); MarkUnplayedResponse res = sdk.media().markUnplayed() .key(59398d) .call(); // handle response } catch (lukehagar.plexapi.plexapi.models.errors.MarkUnplayedResponseBody e) { // handle exception throw e; } catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | | `key` | *double* | :heavy_check_mark: | The media key to mark as Unplayed | 59398 | ### Response **[lukehagar.plexapi.plexapi.models.operations.MarkUnplayedResponse](../../models/operations/MarkUnplayedResponse.md)** ### Errors | Error Object | Status Code | Content Type | | -------------------------------------- | -------------------------------------- | -------------------------------------- | | models/errors/MarkUnplayedResponseBody | 401 | application/json | | models/errors/SDKError | 4xx-5xx | \*\/* | ## updatePlayProgress This API command can be used to update the play progress of a media item. ### Example Usage ```java package hello.world; import java.math.BigDecimal; import java.math.BigDecimal; import java.math.BigInteger; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Optional; import lukehagar.plexapi.plexapi.PlexAPI; import lukehagar.plexapi.plexapi.models.operations.*; import lukehagar.plexapi.plexapi.models.shared.*; import lukehagar.plexapi.plexapi.models.shared.Security; import lukehagar.plexapi.plexapi.utils.EventStream; import org.openapitools.jackson.nullable.JsonNullable; import static java.util.Map.entry; public class Application { public static void main(String[] args) throws Exception { try { PlexAPI sdk = PlexAPI.builder() .accessToken("") .xPlexClientIdentifier("Postman") .build(); UpdatePlayProgressResponse res = sdk.media().updatePlayProgress() .key("") .time(90000d) .state("played") .call(); // handle response } catch (lukehagar.plexapi.plexapi.models.errors.UpdatePlayProgressResponseBody e) { // handle exception throw e; } catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) { // handle exception throw e; } catch (Exception e) { // handle exception throw e; } } } ``` ### Parameters | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `key` | *String* | :heavy_check_mark: | the media key | | | `time` | *double* | :heavy_check_mark: | The time, in milliseconds, used to set the media playback progress. | 90000 | | `state` | *String* | :heavy_check_mark: | The playback state of the media item. | played | ### Response **[lukehagar.plexapi.plexapi.models.operations.UpdatePlayProgressResponse](../../models/operations/UpdatePlayProgressResponse.md)** ### Errors | Error Object | Status Code | Content Type | | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | | models/errors/UpdatePlayProgressResponseBody | 401 | application/json | | models/errors/SDKError | 4xx-5xx | \*\/* |