EndpointGETapi.ashx/v2/cfs/{fileStore}/{filepath}/{filename}
EndpointGETapi.ashx/v2/cfs/resized/{width}x{height}/{fileStore}/{filepath}/{filename}
RequestCfsShowRequest
| FileStore |
Required |
FileStore |
| FilePath |
Required |
FilePath |
| Filename |
Required |
Filename |
| Width |
Optional |
Used when requesting a resized image |
| Height |
Optional |
Used when requesting a resized image |
Example (C#)
// The following code example requests the file from the CFS endpoint and
// writes it to local disk.
using (var webClient = new WebClient()) {
// replace the "admin" and "Admin's API key" with your valid user and apikey!
// http://telligent.com/community/developers/w/wiki/how-to-generate-an-api-key.aspx
var adminKey = String.Format("{0}:{1}", "Admin's API Key", "admin");
var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));
webClient.Headers.Add("Rest-User-Token", adminKeyBase64);
var requestUrl = "http://mysite.com/api.ashx/v2/cfs/{filestore}/{filepath}/{filename}";
using (FileStream writeStream = new FileStream("C:\\some\local\path", FileMode.Create, FileAccess.Write)) {
using (Stream readStream = webClient.OpenRead(requestUrl)) {
int Length = 256;
Byte[] buffer = new Byte[Length];
int bytesRead = readStream.Read(buffer, 0, Length);
while (bytesRead > 0) {
writeStream.Write(buffer, 0, bytesRead);
bytesRead = readStream.Read(buffer, 0, Length);
}
}
}
}