Getting started with building a file system provider API for BEE

Base URL

In order to let BEE consume your FSP (File system provider) API, you will need to provide a Base URL to reach the API.

Base URL: https://myfsp.com/path/to/your/base/endpoint

Note: 

  • the Base URL must not end with a trailing slash (/)
  • it must be hosted on the HTTPS protocol

General data formats

The API uses JSON as the input and output data format.

Responses are JSEND standard compliant (http://labs.omniti.com/labs/jsend).

In case of a succesful response, the API returns a "success" status code (ex. 200 OK) and a JSON object like this one:

{
  "status": "success",
  "data": {
    
  }
}

In case of an unexpected error occured during request processing (i.e. missing mandatory request data), the API returns an "error" status code and a JSON object like this one:

{
  "status": "error",
  "message": "something went wrong accessing backend filesystem"
} 

In case of request failure (i.e. resource not found), the API returns a "fail" status code and a JSON object like this one:

{
  "status": "fail",
  "data": {
    "message": "Resource Not Found",
    "details": "http://myfsp.com/docs/errorcodes/404"
  }
}
Field Type Description

status

string

"success", "error" or "fail" string

message

string

description of the error (for developers only), always in english

data

object

details about the performed operation

 

Next: Security | Sample code

Have more questions? Submit a request

Comments

  • Avatar
    Johnpaul Burbank

    Hello. I need to develop an endpoint API for the Bee plugin to use for images. The documentation says that the base URL needs to use the https protocol, and it looks like it needs to be an absolute URL. I take it that this means that we can not use a URL like https://127.0.0.1/...? I ask as I work on a local server.

  • Avatar
    Sergio M.

    Hi Johnpaul, let me double check with Guillermo and our dev team. I believe that you can use your local server URL as the base URL, along with username and password used to authenticate and connect with the API. Are you getting any errors?

    Edited by Sergio M.
  • Avatar
    Johnpaul Burbank

    Hi Sergio. Thanks that would be great. I've also discovered the wonders of https://ngrok.com

  • Avatar
    Johnpaul Burbank

    Hi Sergio and / or others. In the creation of my FSP endpoint for images I have been able to create the GET and POST method actions. But for some reason the DELETE method on the endpoint does not reach my server. It does not hit a break point at the beginning of the receiving function. It gets through for GET and POST.

    When I use a RESTful client (such as Postman) to hit my endpoints directly, a DELETE request is properly received. There might be a error on your end. In my browser console I sometimes see an error from bee code.

    DELETE https://rsrc.getbee.io/api/cloudstoragemb.jpeg 500 (Internal Server Error)

    It could be something on my server side, but I thought I would ask if there is anything that sticks out to you.

    Thanks,
    Johnpaul

    -------

    Addendum

    I am also curious about error or fail responses sent back to the server. This article explain the data shape for a response in the case of a fail or a error. I've tried this and I don't see any of these message showing up in the file browser. 

    One of the cases that I would like to show this is when a user attempts to create a folder. At this time our API allows for adding images into the base folder, but does not allow sub folders creation. I would like to return an error response with a value that would show in a message dialog. Perhaps it is matter of using a specific error code in the response? I have seen an error dialog in my experimentation with the FSP API, but it has been when I sent back an invalid response and the message seemed to be static.

    Thank you

    Edited by Johnpaul Burbank
  • Avatar
    Johnpaul Burbank

    Hello all. Hope you had a good thanksgiving. I wonder if anyone could respond to my question above. Cheers

  • Avatar
    Sergio M.

    Hi Johnpaul, I've opened a support ticket for our dev team to review. Please use your developer portal to submit these type of technical requests. Thank you!