Skip to content

PaHod/resource-service

Repository files navigation

Sub-task 1: Resource Service

For a Resource Service, it is recommended to implement a service with CRUD operations for processing mp3 files.

Service definition could be next:

POST /resources Upload new resource
Request Parameter Description Restriction Body example Description Restriction
Audio data binary Content type – audio/mpeg MP3 audio data
Response Body Description Code

{

    "id":1123

}

Integer id — ID of the created resource

200 – OK

400 – Validation failed or request body is invalid MP3

500 – An internal server error has occurred

GET /resources/{id} Get the binary audio data of a resource
Request Parameter Description Restriction Body example Description Restriction
Integer id The ID of the resource to get ID of an existing resource
Response Body Description Code
Audio bytes

200 – OK

404 – The resource with the specified id does not exist

500 – An internal server error has occurred

DELETE /resources?id=1,2 Delete a resource(s). If there is no resource for id, do nothing
Request Parameter Description Restriction Body example Description Restriction
String id CSV (Comma Separated Values) of resource IDs to remove Valid CSV length < 200 characters
Response Body Description Code

{

    "ids": [1,2]

}

Integer [] ids – ids of deleted resources

200 – OK

500 – An internal server error has occurred

When uploading a mp3 file, the Resource Service should process the file in this way:

  • Extract file metadata. An external library can be used for this purpose.( e.g. Apache Tika).
  • Store mp3 file to the underlying database of the service as Blob.
  • Invoke Song Service to save mp3 file metadata.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published