Expense report attachment upload fails with 'Unsupported Media Type' error in expense management API

We’re building a mobile expense submission app that integrates with Oracle Fusion Cloud 22D Expense Management. The app successfully creates expense reports via REST API, but attachment uploads consistently fail with HTTP 415 ‘Unsupported Media Type’ errors.

Our implementation sends PDF receipts and JPEG images as multipart/form-data, which should be the correct approach based on the documentation. The expense report creation works fine, but when we attempt to attach files to the report, the API rejects the request.

Error response:


HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json
{"title": "Unsupported Media Type"}

We’ve verified the Content-Type header is set correctly, file sizes are under 5MB, and we’re using POST to the attachments endpoint. The same files upload successfully through the Fusion Cloud web interface.

This is blocking our mobile app launch - employees need to attach receipt images directly from their phones for expense reimbursement.

Oracle Fusion attachment APIs are particular about the multipart structure. You need to include metadata in the request - not just the file bytes. The API expects a JSON part with attachment metadata (fileName, contentType, etc.) and a separate binary part with the actual file content. Both parts need proper Content-Disposition headers. Check the REST API documentation section on attachment uploads - there’s a specific example showing the required multipart structure.

SUCCESS! Resolved the 415 error by properly structuring the multipart/form-data request with separate metadata and file content sections. Here’s the complete solution:

Root Cause: Oracle Fusion Cloud Expense Management REST API requires a specific multipart/form-data structure with separate JSON metadata and binary file parts. Simply uploading file bytes with a generic Content-Type header causes 415 errors.

Correct Multipart Structure:


// Pseudocode - Multipart request structure:
1. Set overall Content-Type: multipart/form-data; boundary=xyz123
2. Add JsonContent part with metadata as JSON:
   Content-Disposition: form-data; name="JsonContent"
   Content-Type: application/json
   {"FileName": "receipt.pdf", "ContentType": "application/pdf"}
3. Add FileContent part with binary data:
   Content-Disposition: form-data; name="FileContent"; filename="receipt.pdf"
   Content-Type: application/pdf
   [binary file data]

Key Implementation Requirements:

  1. Attachment Upload via API: Endpoint: POST /fscmRestApi/resources/11.13.18.05/expenses/{ExpenseReportId}/child/ExpenseItem/{ItemId}/child/Attachment

Must include both report ID and item ID in URL path

  1. Content-Type Header Requirements:
  • Overall request: Content-Type: multipart/form-data; boundary=[auto-generated]
  • JsonContent part: Content-Type: application/json
  • FileContent part: Content-Type must match actual file MIME type (image/jpeg, application/pdf, etc.)
  • Do NOT manually set the boundary - let your HTTP library generate it
  1. Multipart/Form-Data Encoding: Two required parts with exact names (case-sensitive):
  • ‘JsonContent’: Contains attachment metadata JSON Required fields: FileName, ContentType

    Optional fields: Title, Description, CategoryName

  • ‘FileContent’: Contains binary file data Must include filename in Content-Disposition header

  1. Mobile App Integration Considerations:
  • Maximum file size: 5MB per attachment (configurable in Fusion setup)
  • Supported formats: PDF, JPEG, PNG, GIF (verify with your instance config)
  • Handle OAuth token refresh - uploads can take 10-30 seconds for large files
  • Implement retry logic for network timeouts
  • Show upload progress to users (chunk-based upload not supported)

Working Implementation Results:

  • PDF receipts (1-3MB): Upload successfully in 5-8 seconds
  • JPEG images (500KB-2MB): Upload successfully in 2-4 seconds
  • Error handling: Proper validation messages now returned for oversized files
  • Mobile app: Employees can now photograph receipts and attach directly to expense reports

Additional Notes:

  • The web interface uses a different upload mechanism (not REST API), which is why manual uploads worked
  • Attachment visibility follows expense report security - attachments inherit report’s data security
  • After upload, verify attachment by GET request to …/Attachment/{AttachmentId} endpoint
  • Consider implementing local caching for offline submission scenarios

Our mobile expense app is now in production with 200+ users successfully submitting expense reports with receipt attachments daily. Average submission time dropped from 5 minutes (manual web entry) to under 60 seconds via mobile app.

That’s really helpful! We were just sending the file without the separate JSON metadata part. Going to restructure our multipart request with both JsonContent and FileContent sections.

We’re setting Content-Type: multipart/form-data and the boundary is auto-generated by our HTTP library. For the form field, we’re using ‘file’ as the parameter name. Should it be something else specific to Oracle Fusion?