Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

EN | ES

Table of Contents

Introduction

We have already seen how you can upload, edit and share filesusing the platform. Well then, there is a REST API available to perform these functions.

...

As you need authentication to perform these operations, except for GET in some cases, you need to authenticate using OAuth. TO To do this, you must send a GET request to the path '/api-ops/login/username/{username}/password/{password}', replacing the parameters in {curly braces}.


If the credentials are correct, you will receive an access token, "access_token".This is the token you will use in all your requests as an authentication header.

This header will look like this:

NOTE: Remember to include "Bearer" before the access token.

2) CRUD Operation

2.1) Upload a file (POST)

To upload a post, you must make a POST request to the 'controlpanel/binary-repository' endpoint, with two parameters in the body:

  • Binary file ("file", mandatory). Maximum size 50 MB.
  • Metadata ("metadata", optional). This parameter must be sent in text format.
  • Repository ("repository", optional, default defecto Mongo Grid FS). This parameter specifies where you want to stgore the binary files. There are two options, "MONGO_GRIDFS", and "FILE". By default, it's stored in Mongo.

Plus the authentication header.

...

  • Metadata (optional).
  • Binary file ("file"). Maximum size 50MB.

The file will be update updated if you receive a HTTP 202.

...

This API contains the operations this Post article previously described.

To use it, you need to import the two classes from the package:

...

  • Client: BinaryRepositoryClient.java , in charge of implementing the binary repository CRUD via REST.
  • Model: BinaryDataFile.java , this model will be used to encapsulate the binary file that will be requested to the platform.
    este modelo se utilizará para encapsular el fichero binario que solicitemos a la plataforma.

3.1) Client initialization

...