Edit EPUB Metadata

In the rapidly evolving digital landscape, electronic books (EPUBs) have gained immense popularity due to their convenience and accessibility. However, managing the metadata of these e-books is often a crucial but overlooked aspect. Metadata carries essential information about an e-book, such as its title, author, publishing date, and more. In this blog post, we will explore how to utilize the power of Java and GroupDocs.Metadata Cloud API to easily modify EPUB e-book metadata using a REST API. Additionally, we will provide step-by-step instructions on setting up the GroupDocs.Metadata Cloud SDK for Java, and changing metadata properties using specified tags. As a bonus, we will also introduce an online EPUB metadata editor to enhance your metadata management experience.

The following points will be covered in this article:

Setting Up the Environment

Prerequisites:

Before we delve into the implementation, make sure you have the following prerequisites in place:

  • Java Development Kit (JDK) installed.
  • GroupDocs account to obtain API credentials.
  • Basic understanding of REST APIs and Java programming.

Obtaining API Credentials:

To get started, sign up for a GroupDocs cloud account and create an application. The dashboard will provide you with the necessary credentials (App SID and App Key) to authenticate your requests.

Adding the GroupDocs.Metadata Cloud SDK for Java:

To incorporate the SDK into your Java project, you can either download API’s JAR file or install it using Maven by adding the following repository and dependency into your project’s pom.xml file:

Maven Repository:

<repository>
    <id>groupdocs-artifact-repository</id>
    <name>GroupDocs Artifact Repository</name>
    <url>https://repository.groupdocs.cloud/repo</url>
</repository>

Maven Dependency:

<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-metadata-cloud</artifactId>
    <version>23.3</version>
    <scope>compile</scope>
</dependency>

Initializing the API Client

To set up the API client, kindly use your Client ID and Client Secret in the code demonstrated below:

Changing EPUB Metadata Properties

Loading EPUB E-Book:

First of all, upload the EPUB e-book you want to modify. You can accomplish this by employing any of the subsequent methods to upload the files to cloud storage:

  • Upload all files one by one using Upload File API from the browser.
  • Using the dashboard.
  • Upload programmatically using the code example given below:

As a result, the uploaded files will be available in the [files section][https://dashboard.groupdocs.cloud/files] of your dashboard on the cloud.

Common EPUB Metadata properties:

Here are some common metadata properties found in EPUB files:

  • Title: The title of the eBook.
  • Creator: The author or creator of the eBook.
  • Language: The language of the eBook content.
  • Publisher: The publisher of the eBook.
  • Description: A brief description or summary of the eBook.
  • Date: The publication date or creation date of the eBook.
  • Subject: Keywords or phrases that describe the content of the eBook.
  • Rights: Information about the rights and permissions associated with the eBook.
  • Contributor: Other contributors or contributors’ roles (e.g., editor, illustrator).
  • Type: The type of content (e.g., novel, textbook).
  • Format: The format of the eBook file (e.g., EPUB).
  • Identifier: A unique identifier for the eBook (e.g., ISBN, DOI).
  • Coverage: The geographic or temporal coverage of the eBook content.
  • Source: The source of the eBook’s content (if applicable).

Change EPUB Metadata in Java using REST API

Here are the steps and sample code that shows how to change EPUB metadata in Java using REST API.

  1. Create a Configuration object with the MyAppSid and MyAppKey.
  2. Initialize a MetadataApi instance using the created Configuration.
  3. Create a SetOptions object for configuring metadata settings.
  4. Initialize an ArrayList of SetProperty objects to hold metadata properties.
  5. Create a SetProperty object to represent a single metadata property.
  6. Create a SearchCriteria object to define search criteria for metadata.
  7. Create a TagOptions object to specify exact tag options with a tag and category.
  8. Create a Tag object and set its name to “Creator” and category to “Person”.
  9. Set the exact tag in the TagOptions using the created Tag.
  10. Set the search criteria using the created TagOptions.
  11. Set the new metadata value, type, and add the property to the properties list. 7
  12. Configure file information, including the file path for the EPUB file.
  13. Create a SetRequest using the options.
  14. Finally, call the set method on the MetadataApi instance and store the SetResult response.

The following code example shows how to change EPUB metadata in Java using REST API.

Download Resultant Epub File

The code given in the previous step saves the resultant file on the cloud. To download it, you can use the following code snippet.

Bonus: Edit EPUB Metadata Online

Online EPUB Metadata Editor
Enhance your metadata management experience with our Online EPUB Metadata Editor. This user-friendly web-based tool allows you to visually modify metadata properties without writing a single line of code.

Features:

  • Intuitive user interface
  • Real-time preview of metadata changes
  • Support for multiple EPUB metadata properties
  • Cross-platform compatibility

How to Use:

  1. Open GroupDocs.Metadata tool in browser.
  2. Upload or drag the EPUB file.
  3. Review and edit metadata.
  4. Save and download the updated EPUB.

Conclusion

In this blog post, we walked through the process of setting up the SDK, initializing the API client, and changing metadata properties with specified tags. As a cherry on top, we introduced an Online EPUB Metadata Editor as a bonus, offering a user-friendly interface for hassle-free metadata manipulation. Embrace the power of metadata management and elevate your e-book collection to new heights.

The Java-based GroupDocs.Metadata Cloud SDK simplifies the procedure and provides a variety of options for customization. Feel free to explore the documentation, experiment with different settings, and modify metadata for your images or documents to align seamlessly with your branding requirements.

Furthermore, you’ll discover a dedicated API reference section that facilitates direct visualization and interaction with our APIs directly through your web browser. The extensive source code of the Java SDK is openly available on Github.

In the end, our commitment remains focused on creating fresh blog content that revolves around unique file formats and their parsing via REST API. Stay connected for the most recent updates. We wish you success and fulfillment in your coding endeavors!

Ask a question

In case you would have any queries or confusion about the EPUB metadata editor, please feel free to contact us via our forum.

See Also

Here are some related articles that you may find helpful: