Azure Blob Storage

Connect with Azure Blob Storage without any backend coding.

Overview

Azure Blob storage is Microsoft's object storage solution for the cloud. It allows users to store large amounts of unstructured data on Microsoft’s data storage platform. In this case, Blob stands for Binary Large Object, which includes objects such as images and multimedia files. These are known as unstructured data because they don’t follow any particular data model.

Users or client applications can access objects in Blob storage via HTTP/HTTPS, from anywhere in the world. Objects in Blob storage are accessible via the REST API. Therefore, SlashApi provide a simple API endpoint to connect with your Azure Blob Storage data using API without writing any backend code.

Getting Started

After you create an account and log in to the dashboard, choose Azure Blob Storage on the collections page. To make Azure Blob Storage API we need these values:

  • Connection String
  • Container Name

Get your Connection String

To get the connection string, you need to login to your azure portal.

  1. After login to your portal, choose Storage accounts.

  2. Choose Access keys under the Security + Networking section from the left sidebar

  3. You will find your connection string on the Access keys page.

    Azure Connection String

Get your container name

You can get your container name on your Azure Storage accounts. On the left sidebar choose Containers menu under the Data storage section.

Azure container name

API Endpoints

List All Files

List all files in your Azure Blob Storage

GET
<team>/azure/<identifier>/files

Parameters

Parameter Description
recursive Operating on a directory and its contents, including the contents of any subdirectories
directory Directory root

Example

var axios = require('axios');

var config = {
    method: 'get',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f/files?directory=your-directory'
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });

List All Directories

List all directories in your Azure Blob Storage

GET
<team>/azure/<identifier>/directories

Parameters

Parameter Description
recursive Operating on a directory and its contents, including the contents of any subdirectories
directory Directory root

Example

var axios = require('axios');

var config = {
    method: 'get',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f/directories?directory=your-directory'
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });

Download File

Download File from your Azure Blob Storage

GET
<team>/azure/<identifier>/download

Parameters

Parameter Description
path [required] Path to file

Example

var axios = require('axios');

var config = {
    method: 'get',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f/download?path=path-to-file'
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });

Upload File

POST
<team>/azure/<identifier>

Upload File to your Azure Blob Storage.

Request Body

Body Description
file [required] File to upload
directory Destination directory for your uploaded file

Example

var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('/path/to/file'));
data.append('directory', 'target-directory');

var config = {
    method: 'post',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f',
    headers: {
        ...data.getHeaders()
    },
    data : data
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });

Delete Files

Delete Files in your Azure Blob Storage

DELETE
<team>/azure/<identifier>

Request Body

Body Description
files [required] Path to files. To delete multiple files, you can pass an array

Example

var axios = require('axios');
var data = JSON.stringify({
    "files": [
        "Directory/your-file.jpeg"
    ]
});

var config = {
    method: 'delete',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f',
    headers: {
        'Content-Type': 'application/json'
    },
    data : data
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });

Delete Directory

Delete directory in your Azure Blob Storage

DELETE
<team>/azure/<identifier>

Request Body

Body Description
directory [required] Target directory

Example

var axios = require('axios');
var data = JSON.stringify({
    "directory": "target-directory"
});

var config = {
    method: 'delete',
    url: 'http://v1.slashapi.com/slashapi/azure/u2nyrJqa0f',
    headers: {
        'Content-Type': 'application/json'
    },
    data : data
};

axios(config)
    .then(function (response) {
        console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
        console.log(error);
    });