You have already met Media Vault module and learned how it is used to create and manage files used by your applications. This post will provide an introduction to Media Vault REST API endpoints, and posts to follow will cover these endpoints in more detail.

Media Vault Stream

First, let’s talk about the difference between Media Vault and Media Vault Stream. Media Vault Stream represents an actual file in your application (document, image, video…), and Media Vault holds the information about files it stores (the extension type, file size, description…).

Endpoints

  • GET - used to retrieve a media vault stream resource from Baasic (document, image, video, etc.).
  • POST - used to upload a file into Baasic data storage.
  • PUT - used to update existing Baasic files.

We’ll cover these methods in more details in the next posts.

Media Vault

We already said that Media Vault holds all the information about the stored files. If you want to upload a new file, you’ll use Media Vault Stream POST method. When the file is uploaded to Baasic, entry in the Media Vault (information about that file) will be created automatically. Now you understand why there’s no POST option in the Media Vault - you can’t post information about a file without the file itself.

The same applies to Media Vault Stream DELETE option. If you would delete the file from the Media Vault Stream, its information would still be stored in the Media Vault. So, when you want to delete a file, you’ll use Media Vault DELETE method - that way both, file and its information will be removed from the system.

Endpoints

  • GET - used to retrieve a media vault resource from Baasic.
  • GET by search criteria - used to retrieve a (filtered|sorted|paged) collection of media vault resources that match the specified criteria. To see the parameters used for this request, click here.
  • PUT - used to update a media vault resource.
  • PUT batch - used to update collection of media vault resources.
  • DELETE - used to delete a media vault resource.
  • DELETE batch - used to delete a collection of media vault resources.

Media Vault Settings

These are the general settings for the Media Vault module, such as allowed files extensions.

Endpoints

  • GET - used to retrieve media vault settings.
  • PUT - used to update existing media vault settings.

Media Vault Preprocessing Provider Settings

Preprocessing settings are used to set the option for individual preprocessing provider - for now, there’s only Image preprocessing provider, with options for crop and face detection. Preprocessing settings set here are valid for all other modules that support upload and image processing.

Endpoints

  • GET - used to retrieve preprocessing provider settings.
  • GET by search criteria - used to retrieve media vault preprocessing provider settings that match the specified criteria.
  • PUT - used to update previously defined media vault preprocessing provider settings.

All these endpoints let you work with any file in your app, no matter how it got uploaded. Also, don’t forget you can link any of these files to almost any other module as we mentioned in the introductory blog post. Stay tuned to see more on each individual endpoint described here.

Feel free to leave a comment

comments powered by Disqus