{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/files.json","auth":"required","settings":"","examples":{"codes":[{"language":"javascript","code":"var data = new FormData();\n$.each(event.target.files, function (key, value) {\n    data.append(key, value);\n});\ndata.append(\"folderId\", folderId);\n$.ajax({\n    url: 'https://api.projectmanager.com/api/v1/files.json',\n    type: 'POST',\n    data: data,\n    cache: false,\n    dataType: 'json',\n    processData: false, // Don't process the files\n    contentType: false, // Set content type to false as jQuery will tell the server its a query string request\n    headers: {apiKey: \"6120fce4-376c-4602-ad3e-e3e7480ec13d\"},\n}).done(function(data) {\n  console.log(data);\n});"}]},"method":"post","params":[{"name":"file","type":"string","default":"","desc":"Files send by multipart/form-data, example below.","required":true,"in":"body","ref":"","_id":"55651fb6b893840d00444747"},{"name":"folderId","type":"string","default":"My Docs if no timesheet or project id provided, otherwise default to project root folder","desc":"The folder your file will upload to.","required":false,"in":"body","ref":"","_id":"55651fb6b893840d0044474a"},{"name":"taskId","type":"string","default":"","desc":"The task your file will belong to.","required":false,"in":"body","ref":"","_id":"55651fb6b893840d00444749"},{"name":"timesheetId","type":"string","default":"","desc":"The timesheet your file will belong to.","required":false,"in":"body","ref":"","_id":"55651fb6b893840d00444748"}],"results":{"codes":[{"name":"","code":"{\n    \"status\": \"Okay\",\n    \"file\": {\n        \"url\": \"https://secure.projectmanager.com/Share/Public/UserFile.aspx?hid=60F80&bid=c75bd554-5263-4de7-9905-656bacb24f88\",\n        \"id\": 397184,\n        \"name\": \"12%20-%201.jpg\"\n    }\n}","language":"json","status":200}]}},"next":{"description":"","pages":[]},"title":"Upload a File","type":"endpoint","slug":"upload-a-file","excerpt":"Use this API to upload a file into a Folder, or attach a file against a Task or Timesheet record.","body":"Returns the File resource that has just been uploaded.\n\nA File resource is represented by the following properties:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Id\",\n    \"0-1\": \"The unique identifier of the File.\",\n    \"1-1\": \"The download url of the file.\",\n    \"1-0\": \"Url\",\n    \"2-0\": \"Name\",\n    \"2-1\": \"The name of the file.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"55651fb6b893840d00444746","user":"555a5da8bcb32e19006f816f","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5548466cd2c8410d006c2147","554a69ba0b54d30d007fe128","554a7f3338e3620d0082192e","5565162e03b6710d00916942","55651a0c65a1130d00400c2b","55651d4565a1130d00400c2f","55651e0165a1130d00400c32","5565217903b6710d0091695f"],"_id":"5548466bd2c8410d006c2146","createdAt":"2015-05-05T04:26:19.796Z","project":"5548466bd2c8410d006c2143","__v":8,"releaseDate":"2015-05-05T04:26:19.796Z"},"__v":1,"createdAt":"2015-05-27T01:36:54.851Z","category":{"sync":{"isSync":false,"url":""},"pages":["55651e6103b6710d00916957","55651ead65a1130d00400c33","55651fb6b893840d00444746","556523f5b60f251900703442","556524f3eb1615230053fd4d","55652555eb1615230053fd4f"],"title":"Files","slug":"files","order":5,"from_sync":false,"reference":false,"_id":"55651e0165a1130d00400c32","createdAt":"2015-05-27T01:29:37.594Z","project":"5548466bd2c8410d006c2143","__v":6,"version":"5548466bd2c8410d006c2146"},"project":"5548466bd2c8410d006c2143","parentDoc":null,"editedParams":true,"editedParams2":true,"githubsync":""}

postUpload a File

Use this API to upload a file into a Folder, or attach a file against a Task or Timesheet record.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

file:
required
string
Files send by multipart/form-data, example below.
folderId:
stringMy Docs if no timesheet or project id provided, otherwise default to project root folder
The folder your file will upload to.
taskId:
string
The task your file will belong to.
timesheetId:
string
The timesheet your file will belong to.

Examples


Result Format


Documentation

Returns the File resource that has just been uploaded. A File resource is represented by the following properties: [block:parameters] { "data": { "h-0": "Property", "h-1": "Description", "0-0": "Id", "0-1": "The unique identifier of the File.", "1-1": "The download url of the file.", "1-0": "Url", "2-0": "Name", "2-1": "The name of the file." }, "cols": 2, "rows": 3 } [/block]