Skip to content

This repository contains a project that integrates Dropbox API with a Spring Boot app, allowing users to perform file operations through a web service. It utilizes Java for core logic, Spring Boot for web app construction, Maven for dependency management, and Postman for API testing.

Notifications You must be signed in to change notification settings

fedeStaffo/Dropbox-API-Integration-with-Spring-Boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

76 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dropbox API Integration with Spring Boot

This project incorporates Dropbox API into a Spring Boot application, enabling users to perform a range of file operations via a web service. The implementation utilises Java for the core logic, Spring Boot for the construction of the web application, Maven for dependency management, and Postman for testing of the API endpoints. The service allows users to interact with Dropbox, performing tasks such as listing files, retrieving file statistics, and filtering data based on specific criteria.

πŸ“˜ Table of Contents

πŸ’‘ Introduction

This project is a Web Service that allows a client (e.g., Postman) to interact with Dropbox APIs via GET requests. The service enables operations on a specific Dropbox account, such as:

  • Displaying all files in JSON format
  • Obtaining statistics on the data
  • Filtering data based on various parameters
  • Obtaining statistics on filtered data

The project uses the Spring Boot framework. You can run the application from Eclipse by selecting "Run as: SpringBoot App," which starts a Tomcat server on port 8080.

πŸ—„οΈ Data Structure

The data are structured with the following fields:

  1. File/folder name
  2. File/folder path
  3. File extension
  4. Last modified date
  5. File size
  6. Attribute indicating if the file is shared

πŸš€ API Requests

Type Route Function
GET /data Returns all files in the Dropbox account as JSON
GET /stats/dates/mostrecent/{extension} Returns a DataModel with the most recent file of the specified extension
GET /stats/dates/leastrecent/{extension} Returns a DataModel with the least recent file of the specified extension
GET /stats/size/biggestfile/{extension} Returns a string with the name and size of the largest file for the specified extension
GET /stats/size/smallestfile/{extension} Returns a string with the name and size of the smallest file for the specified extension
GET /stats/size/higherdim/{size} Returns the number of files larger than the specified size, grouped by extension
GET /stats/size/lowerdim/{size} Returns the number of files smaller than the specified size, grouped by extension
GET /stats/shared/extension/{extension} Returns the number of shared files for the specified extension
GET /stats/shared/folder Returns the number of shared files in the specified folder, grouped by extension
GET /filter/type/parameter Returns the filtered Dropbox data based on the specified criteria

Note: For requests marked with (X), allowed extensions for demonstration purposes are ".pdf", ".xls", ".jpg", ".doc", ".pptx".

πŸ“Š Response Examples

GET /data

[
    {
        "tag": "folder",
        "name": "subfolder",
        "extension": "null",
        "id": "id:bzscu_Fx4CUAAAAAAAAAMw",
        "server_modified": "null",
        "size": 0,
        "path": "/OnlyMine/subfolder",
        "shared": false
    },
    {
        "tag": "file",
        "name": "report copy.doc",
        "extension": ".doc",
        "id": "id:bzscu_Fx4CUAAAAAAAAAOQ",
        "server_modified": "2021-12-27T18:21:59Z",
        "size": 102912,
        "path": "/OnlyMine/subfolder/report copy.doc",
        "shared": true
    }
]

GET /stats/dates/mostrecent/.pdf

{
    "year": 2022,
    "month": 1,
    "day": 4,
    "name": "Exercise23.11.pdf"
}

GET /stats/size/biggestfile/.doc

The biggest .doc file is "report copy.doc" with a size of 12,864 kilobytes.

GET /stats/size/higherdim/10000 (same for lowerdim)

Files larger than 10,000 bytes:
7 PDF files
1 Excel document
5 JPG images
1 PowerPoint presentation
3 Word documents

GET /stats/shared/extension/.jpg

The number of .jpg files shared is: 2

GET /stats/shared/folder?path=/Only mine Returns a JSON SharedModel showing the count of shared files by extension in the specified folder, along with the total count.

{
    "tot": "Shared per folder: 1",
    "extension1": ".pdf: 1",
    "extension2": ".xls: 0",
    "extension3": ".jpg: 0",
    "extension4": ".pptx: 0",
    "extension5": ".doc: 0"
}

πŸ”Ž Filters

The available filter types are:

  • Name: Returns files whose names start with the specified letter.
  • Extension: Returns files with the specified extension.
  • Date: Returns files last modified on the specified date.
  • Path: Returns files containing the specified path segment.
  • Size:
    • Bigger: Returns files larger than the specified size.
    • Smaller: Returns files smaller than the specified size.

πŸ“ UML Diagrams

Use Cases:

Use Cases

Packages:

Packages

Utility:

Utility

Filters:

Filters

Stats:

Stats

Exceptions:

Exceptions

Controller:

Controller

Sequences:

get data

get data

get stats on dates

dates1

dates2

get stats on size

size1

size2

size3

size4

get stats on shared files

shared1

shared2

get filters

generic filter

πŸ§ͺ Tests

The project includes the following tests:

  • Test 1: Checks that the filtered lists are not empty.
  • Test 2: Verifies that the generated JSON is not empty.
  • Test 3: Ensures there are no discrepancies between the generated JSONs.

πŸ› οΈ Get Started

  1. Open Eclipse.
  2. Launch the application as a Spring Boot App.
  3. Open Postman.
  4. Send requests to the exposed APIs as listed in the table.

πŸ“š Framework & Software

  • jsonsimple: Library used to model JSON files as Java objects.
  • Eclipse: Integrated Development Environment (IDE) used for the project.
  • Spring (v2.6.1): Framework for Java-based web application development.
  • Maven: Build automation tool used for dependency management.
  • JUnit: Framework for unit testing.
  • Postman: Tool used to make HTTP requests to http://localhost:8080.
  • VisualParadigm: Tool for creating UML diagrams.

πŸ‘¨πŸ»β€πŸ’» Authors

Name Email Contribution
Pierandrea Porfiri porfiripierandrea@gmail.com 50%
Federico Staffolani fede01staf@gmail.com 50%

About

This repository contains a project that integrates Dropbox API with a Spring Boot app, allowing users to perform file operations through a web service. It utilizes Java for core logic, Spring Boot for web app construction, Maven for dependency management, and Postman for API testing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages