admin.file

Allows for retrieving and setting details on any given file.

SUPPORTED METHODS:

GET

ParametersTypeDescription
token (required)Valid token
id (required)integerFile id
contentenum (1, 0)

UPDATE

ParametersTypeDescription
token (required)Valid token
id (required)integerFile id
name (accepted)varcharName
description (accepted)varcharDescription
pref_employee_filesenum (1, 0)
positions (accepted)varcharPosition assignments

Array of position ids (eg. "234345,545673,765270")
groups (accepted)varcharGroup assignments

Array of group ids (eg. "2,5,6")
users (accepted)varcharUser assignments

Array of user ids (eg. "927945,759206,3865478"

DELETE

ParametersTypeDescription
token (required)Valid token
id (required)integerFile id
homework (accepted)varcharHomework id

CREATE

token (required)Valid token
filename (required)varcharFile name
filedata (required)varcharFile data
filelength (required)varcharFile length
mimetype (required)varcharMime type
name (accepted)varcharName
description (accepted)varcharDescription
training (accepted)integerTraining id
employee (acepted)integerEmployees id
positions (accepted)varcharPosition assignments

Array of position ids (eg. "234345,545673,765270")
groups (accepted)varcharGroup assignments

Array of group ids (eg. "2,5,6")
users (accepted)varcharUser assignments

Array of user ids (eg. "927945,759206,3865478")

DOCUMENTATION

GET
Retrieving details of any given file.
Level 5 is required (all users can fetch this module)

--

Example Request:

{
       "module":"admin.file",
       "method":"GET",
       "request":{
              "id":"159"
           }
    }

Example Response:

{
       "status":1,
       "data":{
          "id":"159",
          "name":"",
          "description":"",
          "filename":"payroll_export.csv",
          "date":"1339516067",
          "file_size":"239",
          "num_downloads":"0",
          "filetype":"application\/octet-stream",
          "extension":"csv",
          "url":"http:\/\/www.humanity.com\/api\/file\/444.sadas334gfd",
          "secureurl":"http:\/\/www.dev.humanity.com\/app\/admin\/file.php?fid=ddff"
       },
       "token":"xxxxxxx"
    }

CREATE
Uploads and creates details for any given file.
Level 3 is required.

--

Example Request:

{  
            "module":"admin.file",
            "method":"CREATE",
            "request":{  
                    "name":"name",
                    "description":"description",
                    "employee":"154",
                    "mimetype":"image/jpeg",
                    "data":"{//byte array}",
                    "filelength":"{//byte array length}",
                    "positions":"234345,545673,765270",
                    "groups":"2,5,6",
                    "users":"927945,759206,3865478"
              }
          }

Example Response:

{
       "status":1,
       "data":{
              "id":"224",
              "name":"name",
              "description":"description",
              "filename":"payroll_export22.csv",
              "date":"1339516067",
              "file_size":"632",
              "num_downloads":"0",
              "filetype":"application\/octet-stream",
              "extension":"csv",
              "url":"http:\/\/www.humanity.com\/api\/file\/444.suiuh43fef",
              "secureurl":"http:\/\/www.humanity.com\/app\/admin\/file.php?fid=drtyu"
           },
           "token":"xxxxxxx"
    }

UPDATE
Updates details of any given file uploaded.
Level 5 is required (all users can fetch this module)

--

Example Request:

{
       "module":"admin.file",
       "method":"UPDATE",
       "request":{
              "name":"second name",
              "description":"description",
              "training":"training",
              "employee":"154",
              "positions": "234345,545673,765270",
              "groups": "2,5,6",
              "users": "927945,759206,3865478"
       }
    }

Example Response:

{
       "status":1,
       "data":{
              "id":"224",
              "name":"second name",
              "description":"description",
              "filename":"payroll_export22.csv",
              "date":"1339516067",
              "file_size":"632",
              "num_downloads":"0",
              "filetype":"application\/octet-stream",
              "extension":"csv",
              "url":"http:\/\/www.documentapi-s.dev.humanity.com\/api\/file\/444.suiuh43fef",
              "secureurl":"http:\/\/www.humanity.com\/app\/admin\/file.php?fid=drtyu"
           },
       "token":"xxxxxxx"
    }

--

DELETE
Deletes any given file and file details.
Level 3 is required.

--

Example Request:

{
       "module":"admin.file",
       "method":"DELETE",
       "request":{
              "id":"224"
       }
    }

Example Response:

{
       "status":1,
       "data":"",
       "token":"xxxxxxx"
    }