get https://example.com/dns///
Read a public file from the home directory associated with a service.
Authorised and unauthorised requests can invoke this API.
Log in to see full request history
time | status | user agent | |
---|---|---|---|
Retrieving recent requests… |
Loading…
Request Header
Optional parameter
Authorization: Bearer <TOKEN>
Specifying range header
Partial content of the file can be obtained by specifying the range. The start and the end offset can be passed in the range header. This is an optional field, if not specified the entire file is streamed to the client.
Range: bytes 0-1000
Response
Response Headers:
"content-range": "bytes 0-175786/175786"
"accept-ranges": "bytes"
"content-length": "175786"
"created-on": "1970-01-18T00:21:05.210Z"
"last-modified": "1970-01-18T00:21:05.212Z"
"content-type": "text/html"
Reponse Body:
Binary data of the file
Unauthorized
Fields are missing
Examples
var request = require('request');
var fs = require('fs');
var endPoint = 'http://localhost:8100/dns/www/safenetwork/index.html';
var onResponse = function(err, response, body) {
if (err) {
return console.error(err.message);
}
if (response.statusCode === 401) {
return console.error('Failed to authorise');
}
if (response.statusCode === 200) {
console.log(JSON.stringify(response.headers));
return console.log('File downloaded');
}
console.error('Failed to dowload file.', body);
};
var filestream = fs.createWriteStream('./api/index.html');
request.get(endPoint, {
auth: {
bearer: constants.token
}
}, onResponse).pipe(filestream);