All URIs are relative to https://api.ompldr.org/v2
Method | HTTP request | Description |
---|---|---|
getEncryptedFile | GET /get/{id} | Get encrypted file data |
getFile | GET /get/{id}/{privateKey} | Get file |
getInfo | GET /info/{id} | Get file info |
getQuote | POST /quote | Get price quote |
pingGet | GET /ping | Health check |
refreshFile | PUT /refresh/{id} | Refresh file |
uploadFile | POST /upload | Upload file |
getEncryptedFile(id)
Get encrypted file data
Fetch and return encrypted file contents. Data is encrypted with AES-128.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var id = "id_example"; // String | ID of file to fetch
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.getEncryptedFile(id, callback);
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of file to fetch |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/octet-stream
getFile(id, privateKey)
Get file
Fetch, decrypt, and return file contents
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var id = "id_example"; // String | ID of file to fetch
var privateKey = "privateKey_example"; // String | The base 64 encoded private key to decrypt file on server side.
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.getFile(id, privateKey, callback);
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of file to fetch | |
privateKey | String | The base 64 encoded private key to decrypt file on server side. |
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: application/octet-stream
FileInfo getInfo(id)
Get file info
Fetch the current file info.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var id = "id_example"; // String | ID of file to update
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getInfo(id, callback);
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of file to update |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Quote getQuote(body)
Get price quote
Get a storage price quote. You specify the number of bytes to store, the number of downloads, and the number of seconds after which the file expires. Quote price is returned in Satoshis.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var body = new Omploader.QuoteRequest(); // QuoteRequest | Get a storage price quote. A quote is valid for up to 5 minutes after being requested.
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getQuote(body, callback);
Name | Type | Description | Notes |
---|---|---|---|
body | QuoteRequest | Get a storage price quote. A quote is valid for up to 5 minutes after being requested. |
No authorization required
- Content-Type: application/json
- Accept: application/json
pingGet()
Health check
API health check endpoint, which returns 200 when everything's a o.k.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
apiInstance.pingGet(callback);
This endpoint does not need any parameter.
null (empty response body)
No authorization required
- Content-Type: Not defined
- Accept: text/plain
Invoice refreshFile(id, body)
Refresh file
Refresh a file so it doesn't disappear.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var id = "id_example"; // String | ID of file to update
var body = new Omploader.RefreshRequest(); // RefreshRequest | Refreshing a file allows you to extend the storage duration of the specified object.
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.refreshFile(id, body, callback);
Name | Type | Description | Notes |
---|---|---|---|
id | String | ID of file to update | |
body | RefreshRequest | Refreshing a file allows you to extend the storage duration of the specified object. |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Invoice uploadFile(file, opts)
Upload file
Upload a new file. After the upload completes, the invoice must be paid within one hour, before the expiry date. If the invoice isn't paid in time, the file is deleted. The file will be available once the invoice is paid, and until `downloadCount` downloads are used, or `expiresAfterSeconds` has passed. Use the `/refresh` endpoint to extend or increase the number of downloads for a file.
var Omploader = require('omploader');
var apiInstance = new Omploader.DefaultApi();
var file = "/path/to/file.txt"; // File | The file to upload.
var opts = {
'downloadCount': 100, // Number | Maximum number of downloads.
'expiresAfterSeconds': 8.14 // Number | The number of seconds after which this file expires. Defaults to 24h after upload completes.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.uploadFile(file, opts, callback);
Name | Type | Description | Notes |
---|---|---|---|
file | File | The file to upload. | |
downloadCount | Number | Maximum number of downloads. | [optional] [default to 100] |
expiresAfterSeconds | Number | The number of seconds after which this file expires. Defaults to 24h after upload completes. | [optional] |
No authorization required
- Content-Type: multipart/form-data
- Accept: application/json