Table of Contents

API : File Update

Introduction

Update metadata on a file, not the file itself, it can only be deleted.

Request

URL https://api.telecomx.dk/file/ID
Method POST
Access level MANAGER and up, subject to the file's accessLevel: EMPLOYEE = only the uploader, CUSTOMER = same customer, RESELLER/ALL = write access to the file's customer. RESELLER_ADMIN and up always have access.
Param ID Id of the document (24 hex-char string)
Body filename String [optional] New filename. 1-100 characters.
accessLevel String [optional] Determines who can access the file: ALL, CUSTOMER, EMPLOYEE, RESELLER. Files of type PORTING, INTERNET and OTHER keep the access level they were created with - the field is silently ignored for those.
folder Id [optional] Move the document to another folder (must belong to the same customer). Pass null to move it to the customer's root.
fileId Id [optional] Repoint to a different stored file. Rarely used.
duration Number [optional] Media duration in seconds. Rarely used.
description String [optional] New description. Max 100 characters.

Request body example

{
  "description": "My index.html",
  "accessLevel": "ALL"
}

Response

The response will be the updated document metadata, if no errors occurred.

Document object (JSON)
_id ObjectID Id
filename String Filename
fileId ObjectID Id used to reference to file on file server
size Integer Size of the file in bytes
filetype String Filetype: png, jpg, gif, xls, xlsx, doc, docx, pdf, ppt, pptx, txt, csv
folder ObjectId Reference to the folder which contains this file
employee ObjectID Id of employee who added the file
customer ObjectID Id of the customer the file was added to
type String Type of file: PORTING, INTERNET, AUDIO, IMAGE, DOC, FOLDER, OTHER
width Integer If image, then this is the width in pixels
height Integer If image, then this is the height in pixels
description String Optional description for the file, e.g. 'Porting of 81808888'
date ISODate Date and time when the file was added
lastUpdated ISODate Date and time when the file was last updated/edited
accessLevel Enum Determines who can access the file. “ALL”, “CUSTOMER”, “EMPLOYEE”, “RESELLER”

Note that properties holding no value may be omitted from the object.

Example

{
  "_id": "650000000000000000000801",
  "filename": "manual.pdf",
  "size": 12207,
  "filetype": "pdf",
  "fileId": "650000000000000000000901",
  "employee": "650000000000000000000a01",
  "customer": "650000000000000000000101",
  "type": "DOC",
  "date": "2025-03-22T14:40:46.286Z",
  "lastUpdated": "2025-04-22T16:40:46.286Z",
  "accessLevel": "ALL",
  "description": "My manual"
}

Errors

Error code Message Description
422 id File id is invalid
400 No data in body The request body is empty
404 id Not found
422 folder Folder and parent folder don't belong to the same customer
422 accessLevel A personal file can not be created on a reseller's customer
403 accessLevel A file can not be made personal when created by another user
422 <field> A body field is invalid (the error code holds the field name)
403 access_denied Insufficient access level
500 internal_error <Unspecified>