Connect with Scaleway Object Storage without any backend coding.
Scaleway Object Storage is an Object Storage service based on the S3 protocol. It allows you to store any kind of objects (documents, images, videos, etc.). Object Storage service is a cloud product which means that your objects are always available from anywhere in the world.
Objects in Object storage are accessible via the REST API. Therefore, SlashApi provide a simple API endpoint to connect with your Scaleway Object Storage data using API without writing any backend code.
After you create an account and log in to the dashboard, choose Scaleway Object Storage on the collections page. To make Scaleway Object Storage API we need these values:
Let's start with Scaleway access keys to get your encryption key.
Click on your organization name on top of the scaleway dashboard page.
Choose Credentials menu.
Generate new API Key if you don't have one.
List all files in your Scaleway Object Storage
Parameter | Description |
---|---|
recursive | Operating on a directory and its contents, including the contents of any subdirectories |
directory | Directory root |
var axios = require('axios');
var config = {
method: 'get',
url: 'http://v1.slashapi.com/slashapi/scaleway/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 in your Scaleway Object Storage
Parameter | Description |
---|---|
recursive | Operating on a directory and its contents, including the contents of any subdirectories |
directory | Directory root |
var axios = require('axios');
var config = {
method: 'get',
url: 'http://v1.slashapi.com/slashapi/scaleway/u2nyrJqa0f/directories?directory=your-directory'
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Download File from your Scaleway Object Storage
Parameter | Description |
---|---|
path | [required] Path to file |
var axios = require('axios');
var config = {
method: 'get',
url: 'http://v1.slashapi.com/slashapi/scaleway/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 to your Scaleway Object Storage.
Body | Description |
---|---|
file | [required] File to upload |
directory | Destination directory for your uploaded file |
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/scaleway/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 in your Scaleway Object Storage
Body | Description |
---|---|
files | [required] Path to files. To delete multiple files, you can pass an array |
var axios = require('axios');
var data = JSON.stringify({
"files": [
"Directory/your-file.jpeg"
]
});
var config = {
method: 'delete',
url: 'http://v1.slashapi.com/slashapi/scaleway/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 in your Scaleway Object Storage
Body | Description |
---|---|
directory | [required] Target directory |
var axios = require('axios');
var data = JSON.stringify({
"directory": "target-directory"
});
var config = {
method: 'delete',
url: 'http://v1.slashapi.com/slashapi/scaleway/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);
});