📖
Eclipse PASS Documentation
PASS Documentation - DEV
PASS Documentation - DEV
  • Welcome to the Public Access Submission System (PASS) Documentation
  • PASS Welcome Guide
    • Research Submission Overview
    • PASS at JHU
    • PASS Demonstrations at Conferences
    • Technology Stack
    • PASS Architecture
    • Latest Release
    • Setup and Run PASS Locally
    • Collaboration with Other Institutions
    • Contributing to PASS
  • Community
    • Developer Guidelines
    • PASS Roadmap
    • Release Notes
  • Developer Documentation
    • Use Cases
    • PASS Core
      • Authentication & Authorization
      • API
        • DOI API
        • File API
        • Metadata Schema API
        • Policy API
        • User API
      • Model
        • Deposit
        • File
        • Funder
        • Grant
        • Journal
        • Policy
        • Publication
        • Repository
        • RepositoryCopy
        • Submission
        • SubmissionEvent
        • User
    • PASS UI
    • Data Loaders
      • Grant Loader
      • Journal Loader
      • NIHMS Loader
    • Deposit Services
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • Model
      • Statuses
      • Business Logic
      • Assemblers
      • Configuration
      • Next Steps / Institution Configuration
    • Notification Services
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • Model
      • Business Logic
      • Template
      • Dispatch
      • Configuration
      • Next Steps / Institution Configuration
    • PASS Acceptance Testing
    • PASS Docker
      • Testing InvenioRDM
    • Release
      • Automated Release
  • PASS Infrastructure
    • CI/CD
    • Code Quality Analysis
      • Code Coverage
    • Deployment
      • GitHub CI/CD
    • Operations/Production
      • Knowledge Needed / Skills Inventory
      • Technologies Utilized
      • PASS Design & AWS Architecture
      • AWS Cost Estimates
      • PASS Versioning
      • How to Deploy
      • Monitoring
      • Data Loaders
      • Data & Backups
      • Eclipse Operations
      • Next Steps / Institution Configuration
Powered by GitBook
On this page
  • Configuration
  • HTTP Error Responses
  • Usage Examples
  • Upload a file
  • Download a file
  • Delete a file
  1. Developer Documentation
  2. PASS Core
  3. API

File API

The file is a RESTful service that provides the ability to upload, download, and delete files to a configured persistence store. The service is currently designed to persist to a filesystem or S3 compatible storage.

Configuration

The service is configured via environment variables. The service by default will use a filesystem based persistence store and does not require any additional configuration. If the variable PASS_CORE_FILE_SERVICE_ROOT_DIR does not have any value, the File Service will default to the system temp folder and create a temporary root folder of a random value in the system temp. The variable PASS_CORE_FILE_SERVICE_ROOT_DIR is used by both the FILE_SYSTEM and S3 service types. It is the root directory where temporary files are stored before being persisted to the configured persistence store as specified by PASS_CORE_FILE_SERVICE_TYPE.

If using FILE_SYSTEM as the persistence store, PASS_CORE_FILE_SERVICE_ROOT_DIR is also the root directory for file persistence. The value for the PASS_CORE_FILE_SERVICE_ROOT_DIR cannot be a S3 bucket, and it must be a valid path on the local filesystem.

The following environment variables are available for configuring the service:

  • PASS_CORE_FILE_SERVICE_TYPE=FILE_SYSTEM

    • Currently supports [FILE_SYSTEM | S3]

  • PASS_CORE_FILE_SERVICE_ROOT_DIR=/path/to/root/dir

    • The root directory of the service that is used to support file uploads and downloads and the root directory for file persistence if using FILE_SYSTEM as the persistence store.

    • Default example: system_tmp/17318424270250529523

  • PASS_CORE_S3_BUCKET_NAME=bucket-test-name

    • The name of the S3 bucket to use for file persistence if using S3 as the persistence store.

  • PASS_CORE_S3_REPO_PREFIX=s3-repo-prefix

  • PASS_CORE_S3_ENDPOINT=http://localhost:9090

    • If using a custom endpoint for S3, this value should be set to the endpoint URL.

HTTP Error Responses

The service will return the following HTTP error responses:

  • 400 - Bad Request

    • This error is returned when a file is empty or missing. It will also handle exceptions that are thrown by the OCFL library.

  • 404 - Not Found

    • This is returned when performing a GET/DELETE and the fileId is invalid

  • 500 - Internal Server Error

    • This error is returned when an unexpected error occurs in the service.

Usage Examples

Upload a file

curl -u BACKEND_USER:BACKEND_PASS -H "X-XSRF-TOKEN:token" -H "Cookie:XSRF-TOKEN=token" -X POST "http://localhost:8080/file" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "file=@/path/to/file"

Download a file

curl -u BACKEND_USER:BACKEND_PASS -X GET "http://localhost:8080/file/{uuid}/{origFileName}" -H "accept: application/octet-stream" --output /path/to/file" 

Delete a file

curl -u BACKEND_USER:BACKEND_PASS -H "X-XSRF-TOKEN:token" -H "Cookie:XSRF-TOKEN=token" -X DELETE "http://localhost:8080/file/{fileId}/{origFileName}" -H "accept: application/json"
PreviousDOI APINextMetadata Schema API

Last updated 6 months ago