(Beta)
APIs
to store files and optimize images for your website or cloud projects.
No storage and traffic limit
Complete access log in real time
Pay only for the space you use
Multiple locations (coming soon)
About
MGNIERS SPACES is an online service for file storage and delivery, ideal for websites and apps that need flexibility in integrating and managing, as well recording the origin of each access to your files. Currently the service is in the beta phase and will start the commercial production on July 1, 2018.
Doc
1. General Concept
The concept is similar to what you know about your operating system. A Space works like an independent disk drive where you can create directories (also known as folders) and send files into those directories. Each file has a unique URL.
2. Locations
Currently one location is available:

ID Location Api URL
NA1 North America - New York (USA) https://api.na1.spaces.mgniers.com/
3. Spaces
3.1. What's a Space?
A Space, for comparison, is like an independent disk drive, where you can create directories and send files.
The name of a Space integrates the URL of a file, for example: https://{spot-id}.mgniers.com/{space-name}/{file-id}/{file-name}
3.2. Creating a Space
At this time it's not yet possible to create Spaces using our API, but it will be possible soon.
To create a Space, click here. Note: After creating your new Space, don't lose the authentication key, only with it you can manage your Space.
3.3. Querying information of a Space
In this and the following examples, we will use a dummy Space called space01 and the location na1 (North America 01), whose key is "UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci".

Method Protocol(s) URL
GET HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/manage/get/Example: https://api.na1.spaces.mgniers.com/space01/manage/get/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Querying information of a Space
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/manage/get/');
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Query processed successfully.
        )
    [data] => Array
        (
            [active] => 1
            [name] => space01
            [description] => Space 01
            [email] => example@example.com
            [size] => 0
            [created] => 2018-03-10 20:19:40
        )
)
3.4. Editing information of a Space
When making a request to update info of a Space, not necessarily all parameters need to be provided. If you want to update only the Space name, provide only the name parameter, the other info will not change.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/manage/update/Example: https://api.na1.spaces.mgniers.com/space01/manage/update/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
active data bool true or false -- No
name data string Letters, numbers or dash. Lowercase letters, no space. 60 No
description data string Letters, numbers and other special characters. 100 No
update_api_key data bool true or falseIf true, the Space API key will be replaced with a new one. -- No

Updating the info of a Space
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = [
    
'active' => true,
    
'name' => "space01",
    
'description' => "Space 01",
    
'email' => "example@example.com",
    
'update_api_key' => false
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/manage/update/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Space updated successfully.
        )
    [data] => Array
        (
            [active] => 1
            [name] => space01
            [description] => Space 01
            [email] => example@example.com
            [size] => 0
            [api_key] => UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci
            [created] => 2018-03-10 20:19:40
        )
)
3.5. Deleting a Space
For security, data bound to Space isn't immediately deleted. The final exclusion occurs after 10 days.
We are working on an API that makes possible to recover the Space before the final deletion.

Method Protocol(s) URL
GET HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/manage/delete/Example: https://api.na1.spaces.mgniers.com/space01/manage/delete/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Deleting a Space
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/manage/delete/');
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Space deleted successfully.
        )
)
4. Directories
4.1. What's a directory?
The concept is similar to what exists in macOS, Windows, Linux and other operating systems. It's a way to organize your files and manage a set as a whole. Within a directory you can include files and other directories.
4.2. Creating a new directory
When making a request to update info of a directory, not necessarily all parameters need to be provided. If you want to update only the directory name, provide only the name parameter, the other info will not change.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/dir/add/Example: https://api.na1.spaces.mgniers.com/space01/dir/add/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
name data string Letters, numbers and other special characters. 160 Yes
description data string Letters, numbers and other special characters. 255 No
tags data string Words and terms related to the directory or its contents. Use comma to separate the terms.This info will be used in the future to make it easier to search directories and files. 255 No
parent_id data string Parent directory ID.To create a directory in the root of the Space, don't provide the parameter or enter a blank value. 44 No

Updating info of a directory
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = [
    
'parent_id' => "a1vwYGPNnCckLWkv2vGZaE9YZr9oD9NNXkGlMiDXnEZX",
    
'name' => "Old Cars",
    
'description' => "Old cars pictures",
    
'tags' => "Mercedes, Volks, Puma"
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/dir/add/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Directory created successfully.
        )
    [data] => Array
        (
            [id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [name] => Old Cars
            [description] => Old cars pictures
            [tags] => Mercedes, Volks, Puma
            [uri] => old-cars
            [size] => 0
            [created] => 2018-03-11 19:29:54
        )
)
4.3. Querying directory information
Every directory created on the platform has an ID with 44 characters. To carry out the query it is necessary to have this ID.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/dir/get/Example: https://api.na1.spaces.mgniers.com/space01/dir/get/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string Directory ID44 characters - Case-sensitive 44 Yes

Querying directory information
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ['id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/dir/get/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Query processed successfully.
        )
    [data] => Array
        (
            [id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [name] => Old Cars
            [description] => Old cars pictures
            [tags] => Mercedes, Volks, Puma
            [uri] => old-cars
            [size] => 0
            [created] => 2018-03-11 19:29:54
        )
)
4.4. Editing directory Information
When making a request to update the information of a directory, only provide the parameters of info you want to change. Info of not provided parameters will not change.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/dir/update/Example: https://api.na1.spaces.mgniers.com/space01/dir/update/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string Directory ID44 characters - Case-sensitive 44 Yes
name data string Letters, numbers and other special characters. 160 No
description data string Letters, numbers and other special characters. 255 No
tags data string Words and terms related to the directory or its contents. Use comma to separate the terms.This info will be used in the future to make it easier to search directories and files. 255 No
parent_id data string Parent directory IDEmpty value move a directory to the Space root. 44 No

Updating directory information
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = [
    
'id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4",
    
'parent_id' => "M66w4IwP8uycl6RO7oxdPrGnaqKuKkrYHNlijZEAh5uy",
    
'name' => "Old Cars",
    
'description' => "Old cars pictures",
    
'tags' => "Mercedes, Volks, Puma"
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/dir/update/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Directory updated successfully.
        )
    [data] => Array
        (
            [id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [name] => Old Cars
            [description] => Old cars pictures
            [tags] => Mercedes, Volks, Puma
            [uri] => old-cars
            [size] => 0
            [created] => 2018-03-11 19:29:54
        )
)
4.5. Query files and directories of a directory or Space
This API allows you to query the directories and files of a directory or Space. The response will be presented with directional parameters when the query corresponds to a directory or Space.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/dir/list/Example: https://api.na1.spaces.mgniers.com/space01/dir/list/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string Directory ID - 44 characters - Case-sensitiveProvide an empty value to query a list of the directories and files of the Space root. 44 Yes

Getting a list of directories and files of a directory
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ['id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/dir/list/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Query processed successfully.
        )
    [data] => Array
        (
            [kind] => directory
            [info] => Array
                (
                    [id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
                    [name] => Old Cars
                    [description] => Old cars pictures
                    [tags] => Mercedes, Volks, Puma
                    [uri] => old-cars
                    [size] => 0
                    [created] => 2018-03-11 19:29:54
                )
            [list] => Array
                (
                )
        )
)

In this example, the reponse returns the kind parameter with the value directory. When the query matches a Space, this value will be root, only the size parameter will be available within the info parameter.
4.6. Deleting a directory
When requesting the deletion, the internal files and directories will immediately be unavailable. The final exclusion of the directory occurs after 10 days. We are working on an API to recover the directory before the final deletion.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/dir/delete/Example: https://api.na1.spaces.mgniers.com/space01/dir/delete/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string Directory ID44 characters - Case-sensitive 44 Yes

Deleting a directory
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ['id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/dir/delete/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Directory deleted successfully.
        )
    [data] => Array
        (
            [id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [name] => Old cars
            [description] => Old cars pictures
            [tags] => Mercedes, Volks, Puma
            [uri] => old-cars
            [size] => 0
            [created] => 2018-03-11 19:29:54
        )
)
5. Files
5.1. What's a file?
Let's not get into the merit of what's in fact a file, you must already be tired of knowing and living with it. In MGNIERS SPACES, operations involving files are very simple and to ensure flexibility, delivery, availability, control and security.

Currently all the files you send to your Space will have a unique and public URL, accessible anywhere in the world with an internet access point. We do not disclose this URL, it will be at your discretion.

We are working on new access restriction formats and this should be available soon, but again we make it clear that currently any file you submit to MGNIERS SPACES will be publicly available.
5.2. File upload
Currently you can send files up to 600MB with a timeout of 2 hours. The process to send files follows two steps which will be detailed below.
5.2.1. Getting authorization to upload a file
Before submitting a file, you must request an authorization key.

Method Protocol(s) URL
GET HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/file/upload/auth/Example: https://api.na1.spaces.mgniers.com/space01/file/upload/auth/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Getting authorization key to upload a file
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/file/upload/auth/');
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Authorization granted.
        )
    [data] => Array
        (
            [auth] => gWYqjLcWY51J8e2W8yAyY5vefunnjdECNbGa6vRSebrpkErLuCqb86SRwvS8T0l8HzTStMfHDElvidP8OaWuiaBgNaCs01d0kmuD7xj0UyBVGSxaYljAWqlq
            [server] => sp01.mgniers.com
            [uri] => https://sp01.mgniers.com/space01/upload/
            [expire] => 2018-03-11 22:33:06
        )
)

Upon obtaining the authorization, you will receive the authentication key (parameter "auth") and the URI (parameter "uri") to where the file should be sent. The authentication key authorizes the sending of only one file and has an expiration date (currently in two hours) and is broken down in the "expire" parameter. If the key expires or needs to send a second file, a new one should be requested.
5.2.2. Uploading a file
Now that you already have the authorization key, the next step is to submit the file. It's recommended that file submission occur immediately after obtaining the authorization.

Method Protocol(s) URL
POST HTTPS The URL is provided by the authorization response in the uri parameter.

Header
Parameter Value Required
x-auth Authorization key provided by the authorization request in the auth parameter.120 characters - Case-sensitive Yes

POST Parameters
Parameter Type Value Len. Req.
file -- File that you want to send to your space. -- Yes
description string Letters, numbers and other special characters. 255 No
tags string Words and terms related to the file. Use comma to separate the terms.This data will be used to make the file search easier. 255 No
dir_id string Directory ID - 44 characters - Case-sensitive.To send the file to the Space root, don't provide the parameter or enter the parameter with an empty value. 44 No

Sending a file to your Space
PHP
<?php

//continuation of the previous example

$file '/Documents/Time zones.doc';

$post_data = [
    
'file' => new CURLFile($filemime_content_type($file)),
    
'description' => "List of all time zones",
    
'tags' => "time zones, continents, countries",
    
'dir_id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4"
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['x-auth: '.$sh['data']['auth']]);
curl_setopt($chCURLOPT_URL$sh['data']['uri']);
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDS$post_data);
curl_setopt($chCURLOPT_HEADERfalse);
curl_setopt($chCURLOPT_USERAGENT'free_uapi-1.0');
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => File successfully uploaded.
        )
    [data] => Array
        (
            [id] => 5
            [name] => Time zones.doc
            [description] => List of all time zones
            [tags] => time zones, continents, countries
            [size] => 628859
            [dir_id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [uri] => time-zones.doc
            [server] => sp01.mgniers.com
            [url] => sp01.mgniers.com/space01/5/time-zones.doc
            [upload_date] => 2018-03-13 02:18:23
        )
)
5.3. Querying information of a file
To query the a file information, in addition to the default Space authentication, you must provide the file ID.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/file/get/Example: https://api.na1.spaces.mgniers.com/space01/file/get/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string File ID - Case-sensitive -- Yes

Getting information of a file
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ['id' => "5"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/file/get/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Query processed successfully.
        )
    [data] => Array
        (
            [id] => 5
            [name] => Time zones.doc
            [description] => List of all time zones
            [tags] => time zones, continents, countries
            [size] => 628859
            [mime_type] => application/msword
            [dir_id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [uri] => time-zones.doc
            [server] => sp01.mgniers.com
            [url] => sp01.mgniers.com/space01/5/time-zones.doc
            [upload_date] => 2018-03-13 02:18:23
        )
)
5.4. Updating information of a file
Currently you can't overwrite or edit the contents of a file, but you can edit other information.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/file/update/Example: https://api.na1.spaces.mgniers.com/space01/file/update/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string File ID - Case-sensitive -- Yes
name data string Letters, numbers and other special characters.For security and compatibility reasons, some characters may not be supported. 255 Yes
description data string Letters, numbers and other special characters. 255 No
tags data string Words and terms related to the file or its contents. Use comma to separate the terms.This info will be used in the future to make it easier to search files. 255 No
dir_id data string Directory ID - 44 characters - Case-sensitiveTo move the file to the Space root, provide the parameter with an empty value. 44 No

Updating information of a file
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = [
    
'id' => "5",
    
'name' => "Time zones.doc",
    
'description' => "List of all time zones",
    
'tags' => "time zones, continents, countries",
    
'dir_id' => "QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4"
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/file/update/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response is not a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => File updated successfully.
        )
    [data] => Array
        (
            [id] => 5
            [name] => Time zones.doc
            [description] => List of all time zones
            [tags] => time zones, continents, countries
            [size] => 628859
            [mime_type] => application/msword
            [dir_id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [uri] => time-zones.doc
            [server] => sp01.mgniers.com
            [url] => sp01.mgniers.com/space01/5/time-zones.doc
            [upload_date] => 2018-03-13 02:18:23
        )
)
5.5. Accessing a file
At any time, when uploading a file or updating a file info, you will receive the url (URL) parameter. To access the file, simply call the URL using the HTTP or HTTPS protocol.

Method Protocol(s) URL
GET HTTP/HTTPS https://{spot-id}.mgniers.com/{space-name}/{file-id}/{file-name}Example: https://sp01.mgniers.com/space01/5/time-zones.doc
5.6. Image treatment
5.6.1. Resizing an image
For PNG, JPEG or GIF images with a size less than 20MB, it's possible to do the resizing directly by API. To do this, enter the resize parameter in the URL, before the file URI, as shown below.

Method Protocol(s) URL
POST HTTPS https://{spot-id}.mgniers.com/{space-name}/{file-id}/resize/{file-name}.{jpg|gif|png}https://sp01.mgniers.com/space01/8/resize/car.jpg

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

When resizing, a copy of the original image is saved and then replaced by the image with the new dimensions. This copy is necessary to handle future resizing, preserving image quality even after numerous resizing with different parameters.

Body - JSON
Parameter Type Value Len. Req.
type string fixed (Default) - set a fixed width and height for the image;
limited - set a limit for the width and height;
-- No
id string Allows you to define an ID for resizing to be used with the zoom parameter. A new imagem file is created with the defined dimensions, or replace the image with the same ID, if it already exists. 10 No
replace bool If true, the main image will be replaced by the image with the new dimensions. -- No
width integer
When the type parameter is fixed:
Width in pixels for which the image will be resized (1 to 4200).If not provided, the width will be calculated based on the proportion of the original image. Required if the height parameter isn't provided.
When the type parameter is limited:
Sets the maximum width allowed for the image (2 to 5600).If the image width is smaller than this value, the width of the image will not change. This parameter is required.
1 to 4 --
height integer
When the type parameter is fixed:
Height in pixels to which the image will be resized (1 to 4200).If not provided, the height will be calculated based on the proportion of the original image. Required if the width parameter isn't provided.
When the type parameter is limited:
Sets the maximum height allowed for the image (2 to 5600).If the image height is smaller than this value, the height of the image will not change. This parameter is required.
1 to 4 --
quality integer Image quality after resizing. From 0 (worst quality) to 100 (best quality).The lower the quality, the smaller the file size. 3 No
aspect_ratio bool If true, the image will be resized preserving the aspect ratio. Can be used only when the value of the type parameter is equal fixed. -- No

Resizing an image
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = [
    
'type' => "fixed",
    
'replace' => true,
    
'width' => 600,
    
'height' => 800,
    
'quality' => 90,
    
'aspect_ratio' => true
];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://sp01.mgniers.com/space01/8/resize/car.jpg');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode($data));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Done.
        )
)
5.6.2. Parameter "zoom"
The zoom parameter allows you to access the different resizing of the image. If there are no resized images, the default image will be returned.

URL of an image using the "zoom" parameter
Method Protocol(s) URL
GET HTTP/HTTPS https://{spot-id}.mgniers.com/{space-name}/{file-id}/zoom/[{resize-id}]/{file-name}.{jpg|gif|png}Example: https://sp01.mgniers.com/space01/8/zoom/test-big/car.jpg

When you do a resize without provide an ID, a default image for zoom is created, so the resize-id parameter in the URL is optional.
5.7. Logs
5.7.1. File requisitions
With this API you can consult the source of each access to your files. Currently this query is limited to 200 results, sorted from the most recent to the oldest. We are working to expand this feature.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/file/log/requests/https://api.na1.spaces.mgniers.com/space01/file/log/requests/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string File ID - Case-sensitiveIf not provided, will be displayed the most recent requests logs, regardless of the file. -- No

Querying the latest requests to a file
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ["id" => "8"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/file/log/requests/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode($data));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => Query processed successfully!
        )
    [data] => Array
        (
            [list] => Array
                (
                    [0] => Array
                        (
                            [user_agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
                            [user_ip] => ::1
                            [referer] => 
                            [created] => 2018-03-29 03:50:59
                        )
                    [1] => Array
                        (
                            [user_agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
                            [user_ip] => ::1
                            [referer] => http://www.example.com/documents/
                            [created] => 2018-03-29 03:44:41
                        )
                    [2] => Array
                        (
                            [user_agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6
                            [user_ip] => ::1
                            [referer] => 
                            [created] => 2018-03-29 03:44:32
                        )
                )
        )                                                
)
5.8. Deleting a file
When requesting the deletion, the file is immediately unavailable both publicly and to the owner. The final exclusion occurs after 10 days. We are working on API to recover files before final deletion.

Method Protocol(s) URL
POST HTTPS https://api.{location-id}.spaces.mgniers.com/{space-name}/file/delete/Example: https://api.na1.spaces.mgniers.com/space01/file/delete/

Header
Parameter Value Required
Content-Type application/json Yes
x-key Space API Key - Example: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci41 characters - Case-sensitive Yes

Body - JSON
Parameter Parent Type Value Len. Req.
data -- array -- -- Yes
id data string File ID - Case-sensitive -- Yes

Deleting a file
PHP
<?php

header
("content-type: text/plain; charset=utf-8");

$data = ['id' => "5"];

$ch curl_init();
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HTTPHEADER, ['Content-Type: application/json''x-key: UD8O2LMoCehLF40QpnY466hR4s2LIFEvQnMngn0Ci']);
curl_setopt($chCURLOPT_URL'https://api.na1.spaces.mgniers.com/space01/file/delete/');
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_POSTFIELDSjson_encode(['data' => $data]));
curl_setopt($chCURLOPT_HEADERfalse);
$sh_rc curl_exec($ch);
$http_code curl_getinfo($chCURLINFO_HTTP_CODE);
$error curl_errno($ch);
curl_close($ch);

if(
$error 0) exit("Failed to communicate with the remote server.");

$sh = @json_decode($sh_rctrue);
if(
is_null($sh) || !is_array($sh)) exit("Response isn't a valid JSON.");

print_r($sh);                    

?>

The above script will print the following output:
Array
(
    [response] => Array
        (
            [code] => Y001
            [message] => File deleted successfully.
        )
    [data] => Array
        (
            [id] => 5
            [name] => Time zones.doc
            [description] => List of all time zones
            [tags] => time zones, continents, countries
            [size] => 628859
            [mime_type] => application/msword
            [dir_id] => QwdnbrrYq4uVXRjPPXbmyjTKmfZWpdo2lJ8BPEMKzKA4
            [uri] => time-zones.doc
            [server] => sp01.mgniers.com
            [url] => sp01.mgniers.com/space01/5/time-zones.doc
            [upload_date] => 2018-03-13 02:18:23
        )
)
Price
While in the beta phase, MGNIERS SPACES will not charge, but when it enters the definitive production phase, it's estimated that USD 0.50/month will be charged for each GB stored. At the moment we have no plans to charge for traffic, but according to demand this may be revised in the future.
Contact
If you need help, have questions or want more information, please contact us filling out the next form or sending an email to the address .
Please wait...