List all methods of REST API and explain the API functionality

Create folder

API URL: {domain}/FileService/createFolder

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Query Params:

offset

limitOfset

parentFolderId

Body:

{
    "fileName": "folderName"
}

Parameter Desc:

fileName คือ ชื่อของ folder ที่จะสร้าง

Response:

จะได้ folder id จาก file_app_id เพื่อนำมาใช้งานต่อได้

{
    "success": true,
    "data": {
        "file_app_id": "xxxxxxxx-8ebe-4b55-9476-86beabe9bd0b",
                          ...
    },
    "message": "create directory Successfully."
}

Sample Request:

{"name": "createFolder",
	"request": {
			"method": "POST",
			"header": [
			{"key": "Accept",
			 "value": "application/json, text/plain, */*"
			},
			{"key": "Accept-Language",
			 "value": "en,th-TH;q=0.9,th;q=0.8"
			},
			{"key": "Authorization",
			 "value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmaXJzdG5hbWUiOiJ3IiwidXNlcl9pZCI6MjUyMiwiZ3JvdXBfaWQiOi0yLCJzeXN0ZW1faWQiOnsiNDEzMCI6eyJyb2xlcyI6WyJjdXNlciJdfX0sImV4cCI6MTY2NTcyNDc5NywiZW1haWwiOiJ3c0BnbWFpbC5jb20iLCJsYXN0bmFtZSI6InMifQ.qjqBZgbyhZ7katA6eHjFOC1K_YQqUjX5PZyUnDvfBmnfFjunft9eWnqwE0atxCqlurCzT6ffO3M-cNUDmvRPNvTtcpNmZF-k-fGU2RjFfrHuhXeLfgUGQXQEnZL-prQuvd6pc92n-2CE9_dJiW3fYDSxZovvXHaMeqgZD1YbpDbLUjMOrhlgLugfx2jiwZAulZQANMuxQxaXuQD7_YRvwSjpzIumnRwg-NF0z-VEKiq_aEL_E5miRSia4Xycka1dBCcWqq0AZrJ9QeutIQK9G_OBMj_P3zmxitXnGyh-B3kq4zwV39JPXV5dHXH0Zn19MipKL_iMWvGNacWWT3tpxw"
			},
			{"key": "Cache-Control",
			 "value": "no-cache"
			},
			{"key": "Connection",
			 "value": "keep-alive"
			},
			{"key": "Content-Type",
			 "value": "application/json"
			},
			{"key": "Cookie",
			 "value": "_ga=GA1.1.1275316013.1665174886; hash=0a3f827a-8a8f-48b5-ad8f-2e2a24c2adda; google_client=901505304449-s5bjapj91t72fuimp0tlq2aubvjicsai.apps.googleusercontent.com; io=aZa73-vqG_TrxoJIAAGE; _ga_1LCBB2Q7SS=GS1.1.1665471937.7.1.1665471953.0.0.0"
			},
			{"key": "Origin",
			 "value": "https://mocha.centerapp.io"
			},
			{"key": "Pragma",
			 "value": "no-cache"
			},
			{"key": "Referer",
			 "value": "https://mocha.centerapp.io/center-web/file"
			},
			{"key": "Sec-Fetch-Dest",
			 "value": "empty"
			},
			{"key": "Sec-Fetch-Mode",
			 "value": "cors"
			},
			{"key": "Sec-Fetch-Site",
			 "value": "same-origin"
			},
			{"key": "User-Agent",
			 "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
			},
			{"key": "sec-ch-ua",
		         "value": "\"Google Chrome\";v=\"105\", \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"105\""
			},
			{"key": "sec-ch-ua-mobile",
			 "value": "?0"
			},
			{"key": "sec-ch-ua-platform",
			 "value": "\"Windows\""
			}
			],
			"body": {"mode": "raw",
				 "raw": "{\r\n    \"fileName\": \"Sub1\",\r\n    \"userId\": \"\",\r\n    \"groupId\": \"\",\r\n    \"entryp\": false,\r\n    \"controlVersion\": false,\r\n    \"parentFolderId\" :\"ca8cf846-b483-467e-b1f1-cb1a8ec038cd\"\r\n}"
				 },
			"url": {"raw": "https://mocha.centerapp.io/FileService/createFolder",
				"protocol": "https",
				"host": [
					 "mocha",
					 "centerapp",
					 "io"
					],
				"path": [
					 "FileService",
					 "createFolder"
					]
				}
			},
	"response": []
}

Upload File

API URL: {domain}/FileService/uploadFile

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : multipart/form-data

Form Data:

file

parent_folder_id

filename

groupId

Parameter Desc:

file คือไฟล์ที่เป็น blob

parent_folder_id คือ id ของ folder ที่จะอัพโหลดเข้า ถ้าอัพโหลดไว้ root ไม่ต้องส่ง id

filename คือ ชื่อของไฟล์

Response:

จะได้ file id จาก file_app_id เพื่อนำมาใช้งานต่อได้

{
    "success": true,
    "data": {
        "file_app_id": "xxxxxxxx-eaa0-4f12-98d0-400612d6a0cb",

    },
    "message": "upload file success."
}

Sample Request:

{"name": "uploadFile",
 "request": {
 	"auth": { "type": "noauth" },
	"method": "POST",
	"header": [
			{
			 "key": "Connection",
			 "value": "keep-alive"
			},
			{
			 "key": "sec-ch-ua",
			 "value": "\" Not;A Brand\";v=\"99\", \"Google Chrome\";v=\"91\", \"Chromium\";v=\"91\""
			},
			{
			 "key": "Accept",
			 "value": "application/json, text/plain, */*"
			},
			{
			 "key": "Authorization",
			 "value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmaXJzdG5hbWUiOiJ3IiwidXNlcl9pZCI6MjUyMiwiZ3JvdXBfaWQiOi0yLCJzeXN0ZW1faWQiOnsiNDEzMCI6eyJyb2xlcyI6WyJjdXNlciJdfX0sImV4cCI6MTY2NTcyNDc5NywiZW1haWwiOiJ3c0BnbWFpbC5jb20iLCJsYXN0bmFtZSI6InMifQ.qjqBZgbyhZ7katA6eHjFOC1K_YQqUjX5PZyUnDvfBmnfFjunft9eWnqwE0atxCqlurCzT6ffO3M-cNUDmvRPNvTtcpNmZF-k-fGU2RjFfrHuhXeLfgUGQXQEnZL-prQuvd6pc92n-2CE9_dJiW3fYDSxZovvXHaMeqgZD1YbpDbLUjMOrhlgLugfx2jiwZAulZQANMuxQxaXuQD7_YRvwSjpzIumnRwg-NF0z-VEKiq_aEL_E5miRSia4Xycka1dBCcWqq0AZrJ9QeutIQK9G_OBMj_P3zmxitXnGyh-B3kq4zwV39JPXV5dHXH0Zn19MipKL_iMWvGNacWWT3tpxw"
			},
			{
			 "key": "sec-ch-ua-mobile",
			 "value": "?0"
			},
			{
			 "key": "User-Agent",
			 "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36"
			},
			{
			 "key": "Content-Type",
			 "value": "application/json"
			},
			{
			 "key": "Origin",
			 "value": "https://mocha.centerapp.io"
			},
			{
			 "key": "Sec-Fetch-Site",
			 "value": "same-origin"
			},
			{
			 "key": "Sec-Fetch-Mode",
			 "value": "cors"
			},
			{
			 "key": "Sec-Fetch-Dest",
			 "value": "empty"
			},
			{
			 "key": "Referer",
			 "value": "https://mocha.centerapp.io/login"
			},
			{
			 "key": "Accept-Language",
			 "value": "en,th-TH;q=0.9,th;q=0.8"
			},
			{
			 "key": "Cookie",
			 "value": "G_ENABLED_IDPS=google; G_ENABLED_IDPS=google; io=IwucHqCyIsUoRQ6GAAXW"
			}
			],
			"body": {
				 "mode": "formdata",
				 "formdata": [
						{
						 "key": "fileName",
						 "value": "test1",
						 "type": "text"
						},
						{
						 "key": "groupId",
						 "value": "",
						 "type": "text"
						},
						{
						 "key": "file",
						 "type": "file",
						 "src": "/C:/Users/win/Downloads/Defect-Feature List NHA Center 0710 (2).xlsx"
						},
						{
						 "key": "parentFolderId",
						 "value": "",
						 "type": "text"
						},
						{
						 "key": "userId",
						 "value": "",
						 "type": "text"
						}
					]
				},
				"url": {
					"raw": "https://mocha.centerapp.io/FileService/upload",
					"protocol": "https",
					"host": [
						"mocha",
						"centerapp",
						"io"
					],
					"path": [
						"FileService",
						"upload"
					]
				}
			},
	"response": []
}

Rename

API URL: {domain}/FileService/rename

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Body:

{
    "renameTo": "newName",
    "oldName": "existingFileName",
    "fileId": "xxxxxxxx-52d5-4bf2-80e7-dbf54e5ab8be"
}

Parameter Desc:

renameTo คือ ชื่อใหม่ของ folder/file ที่จะเปลี่ยนชื่อ

oldName คือ ชื่อเก่าของ folder/file ที่จะเปลี่ยนชื่อ

fileId คือ id ของ folder/file ที่จะเปลี่ยนชื่อ

Response:

จะได้ข้อมูล folder/file ที่แก้ไขชื่อแล้ว

{
    "success": true,
    "message": "rename Successfully.",
    "data": {
        "file_app_id": "xxxxxxxx-52d5-4bf2-80e7-dbf54e5ab8be",
        "file_name": "image222",
        ...
    }
}

Sample Request:

{"name": "rename",
 "request": {
	"method": "POST",
	"header": [
			{
			 "key": "Accept",
			 "value": "application/json, text/plain, */*"
			},
			{
			 "key": "Accept-Language",
			 "value": "en,th-TH;q=0.9,th;q=0.8"
			},
			{
			 "key": "Authorization",
			 "value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmaXJzdG5hbWUiOiJ1c2VyXzk2MjEwMDAxMiIsInVzZXJfaWQiOjIyMzAsImdyb3VwX2lkIjotMiwic3lzdGVtX2lkIjp7fSwiYXZhdGFyIjoiaHR0cHM6Ly9tb2NoYS5jZW50ZXJhcHAuaW86L0lBTTJXZWIvRmlsZVNlcnZsZXQ_dXNlcm5hbWU9c3VyYXBhLmtAYXZsZ2IuY29tJmdyb3VwX2lkPS0yIiwiZXhwIjoxNjY3MDE1NTAzLCJlbWFpbCI6InN1cmFwYS5rQGF2bGdiLmNvbSIsImxhc3RuYW1lIjoiaWNlIn0.Cqz8W1f1Zpq7Cc4SaXTbvAwJgtTrJ7k9EFtkL2c0ww1MOqhJa2KAbicAtftZe-C1kdSb2IKebcADVxcEMwhzY3g3Ldhfspf-oSNwtZSr-bympFnO5qfhxLcfo6moT-IZc2qblzOcPD9zWwu9vT20Ycq4LulogasuvxV9V8rOreDAQGGIeMYHX6khKauFxJRb8fbck9ixXAkS6FzL-yIc8yvLp1B_8wlAFZ6q52FCeH2R-eWKrTIVBpIFDBxVJpamjb60ZAAVTUvC0MNGutKL1BvKw3bFqilWqAAASHEQComRlaaeO6c7mrn7e1De7NbFSsDhpT-9_4aPE36tP6kkhQ"
			},
			{
			 "key": "Cache-Control",
			 "value": "no-cache"
			},
			{
			 "key": "Connection",
			 "value": "keep-alive"
			},
			{
			 "key": "Content-Type",
			 "value": "application/json"
			},
			{
			 "key": "Cookie",
			 "value": "_ga=GA1.1.52028462.1666177005; hash=b56ddd6f-dd53-4a84-b9e4-59ee037621fd; google_client=901505304449-s5bjapj91t72fuimp0tlq2aubvjicsai.apps.googleusercontent.com; facebook_client=851383785552969; io=-YrAy8VIjYNQ_7IfAABm; _ga_1LCBB2Q7SS=GS1.1.1666766541.12.1.1666768278.0.0.0"
			},
			{
			 "key": "Origin",
			 "value": "https://mocha.centerapp.io"
			},
			{
			 "key": "Pragma",
			 "value": "no-cache"
			},
			{
			 "key": "Referer",
			 "value": "https://mocha.centerapp.io/center-web/file"
			},
			{
			 "key": "Sec-Fetch-Dest",
			 "value": "empty"
			},
			{
			 "key": "Sec-Fetch-Mode",
			 "value": "cors"
			},
			{
			 "key": "Sec-Fetch-Site",
			 "value": "same-origin"
			},
			{
			 "key": "User-Agent",
			 "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
			},
			{
			 "key": "sec-ch-ua",
			 "value": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""
			},
			{
			 "key": "sec-ch-ua-mobile",
			 "value": "?0"
			},
			{
			 "key": "sec-ch-ua-platform",
			 "value": "\"Windows\""
			}
		],
		"body": {
			 "mode": "raw",
			 "raw": "{\"renameTo\":\"MicrosoftTeams-image (56)66\",\"oldName\":\"MicrosoftTeams-image (56)\",\"fileId\":\"1820861c-d194-4d1c-835f-10ccb70f8ecd\"}"
			},
		"url": {
			 "raw": "https://mocha.centerapp.io/FileService/rename",
			 "protocol": "https",
			 "host": [
					"mocha",
					"centerapp",
					"io"
				 ],
			 "path": [
					"FileService",
					"rename"
				 ]
			 }
			},
		"response": []
}

Get File from Folder

API URL: {domain}/FileService/getFiles?offset=0&limitOfset=30&parentFolderId=

METHOD: GET

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Query Params:

offset
limitOfset
parentFolderId

Parameter Desc:

offset คือ ต่ำแหน่งเริ่มต้นที่จะดึงไฟล์

limitOfset คือ จำนวนการดึงไฟล์

parentFolderId คือ id ของ folder ที่จะอดึงไฟล์ ถ้าดึงจาก root ไม่ต้องส่ง id

Response:

{
    "success": true,
    "message": "get file Successfully.",
    "total": 2,
    "data": [
        {
            "file_app_id": "xxxxxxxx-6eb0-4ec1-b7ca-3bea71ba3b8b",
	               ...
        },
        {
            "file_app_id": "xxxxxxxx-8ebe-4b55-9476-86beabe9bd0b",
            ...
        }
    ]
}

Sample Request:

{
"name": "get file folder",
"request": {
	"method": "GET",
	"header": [
		{
			"key": "Accept",
			"value": "application/json, text/plain, */*"
		},
		{
			"key": "Accept-Language",
			"value": "en,th-TH;q=0.9,th;q=0.8"
		},
		{
			"key": "Authorization",
			"value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmaXJzdG5hbWUiOiJ3IiwidXNlcl9pZCI6MjUyMiwiZ3JvdXBfaWQiOi0yLCJzeXN0ZW1faWQiOnsiNDEzMCI6eyJyb2xlcyI6WyJjdXNlciJdfX0sImV4cCI6MTY2NTcyNDc5NywiZW1haWwiOiJ3c0BnbWFpbC5jb20iLCJsYXN0bmFtZSI6InMifQ.qjqBZgbyhZ7katA6eHjFOC1K_YQqUjX5PZyUnDvfBmnfFjunft9eWnqwE0atxCqlurCzT6ffO3M-cNUDmvRPNvTtcpNmZF-k-fGU2RjFfrHuhXeLfgUGQXQEnZL-prQuvd6pc92n-2CE9_dJiW3fYDSxZovvXHaMeqgZD1YbpDbLUjMOrhlgLugfx2jiwZAulZQANMuxQxaXuQD7_YRvwSjpzIumnRwg-NF0z-VEKiq_aEL_E5miRSia4Xycka1dBCcWqq0AZrJ9QeutIQK9G_OBMj_P3zmxitXnGyh-B3kq4zwV39JPXV5dHXH0Zn19MipKL_iMWvGNacWWT3tpxw"
		},
		{
			"key": "Cache-Control",
			"value": "no-cache"
		},
		{
			"key": "Connection",
			"value": "keep-alive"
		},
		{
			"key": "Cookie",
			"value": "_ga=GA1.1.1275316013.1665174886; hash=0a3f827a-8a8f-48b5-ad8f-2e2a24c2adda; google_client=901505304449-s5bjapj91t72fuimp0tlq2aubvjicsai.apps.googleusercontent.com; io=aZa73-vqG_TrxoJIAAGE; _ga_1LCBB2Q7SS=GS1.1.1665471937.7.1.1665471953.0.0.0"
		},
		{
			"key": "Pragma",
			"value": "no-cache"
		},
		{
			"key": "Referer",
			"value": "https://mocha.centerapp.io/center-web/file/id/my-id/folder/ca8cf846-b483-467e-b1f1-cb1a8ec038cd"
		},
		{
			"key": "Sec-Fetch-Dest",
			"value": "empty"
		},
		{
			"key": "Sec-Fetch-Mode",
			"value": "cors"
		},
		{
			"key": "Sec-Fetch-Site",
			"value": "same-origin"
		},
		{
			"key": "User-Agent",
			"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
		},
		{
			"key": "sec-ch-ua",
			"value": "\"Google Chrome\";v=\"105\", \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"105\""
		},
		{
			"key": "sec-ch-ua-mobile",
			"value": "?0"
		},
		{
			"key": "sec-ch-ua-platform",
			"value": "\"Windows\""
		}
	],
	"url": {
			"raw": "https://mocha.centerapp.io/FileService/getFiles?groupId=&offset=0&limitOfset=&parentFolderId=xxxxxxxx-b483-467e-b1f1-cb1a8ec038cd&tag=",
			"protocol": "https",
			"host": [
					"mocha",
					"centerapp",
					"io"
				],
			"path": [
					"FileService",
					"getFiles"
				],
			"query": [
				{
					"key": "groupId",
					"value": ""
				},
				{
					"key": "offset",
					"value": "0"
				},
				{
					"key": "limitOfset",
					"value": ""
				},
				{
					"key": "parentFolderId",
					"value": "xxxxxxxx-b483-467e-b1f1-cb1a8ec038cd"
				},
				{
					"key": "tag",
					"value": ""
				}
				]
			}
		},
	"response": []
}

List File from Community or Group

API URL: {domain}/FileService/getFiles?groupId=xxx&offset=0&limitOfset=30&parentFolderId=

METHOD: GET

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Query Params:

groupId
offset
limitOfset
parentFolderId

Parameter Desc:

groupId the community/ group id

offset คือ ต่ำแหน่งเริ่มต้นที่จะดึงไฟล์

limitOfset คือ จำนวนการดึงไฟล์

parentFolderId คือ id ของ folder ที่จะอดึงไฟล์ ถ้าดึงจาก root ไม่ต้องส่ง id

Response:

{
    "success": true,
    "message": "get file Successfully.",
    "total": 2,
    "data": [
        {
            "file_app_id": "xxxxxxxx-6eb0-4ec1-b7ca-3bea71ba3b8b",
	               ...
        },
        {
            "file_app_id": "xxxxxxxx-8ebe-4b55-9476-86beabe9bd0b",
            ...
        }
    ]
}

Sample Request:

{
"name": "list file",
"request": {
	"method": "GET",
	"header": [
		{
			"key": "authority",
			"value": "centerapp.io"
		},
		{
			"key": "accept",
			"value": "application/json, text/plain, */*"
		},
		{
			"key": "authorization",
			"value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJlNDlmMWUzOS00ZDViLTQxZDItYTFjYS00ZDU4MzIyYTUzMDAiLCJzdWIiOiJhY2Nlc3NUb2tlbiIsImlzcyI6Imh0dHBzOi8vaWFtLmNlbnRlcmFwcC5pby9JQU0yV2ViIiwiZXhwIjoxNjI4NTcyODE2NzF9.cMJg87FeOxz_2CqnFFKwTxcXQ06davOiGJ_pFVwX0bZh35zwHkKKjnJ4P4fPXBvE6gNFcXCVnIVifvYvacq-mxBQFeRqa4YF3oatiO6yZGQwtLx7IBIgjNRYBBykBBGhaHxJVLZqFVByFAcDVI48uDRlgvQ0sNwfEFccEy93oR8VaM7Q2A9iAkHdaF1bvjIOj9q49A4eFcZM8ydWLFI52xfTIe6ElINgeupN5yjHpg2Cj4H7v9oaOzS92qI62dejMm_swXDf-S7ZhwEg3u9yBoUR6HjbNzxr2XAfYl4e3f-HBh3D4NiUW2w5LMjrIgS64JruRfPvnWzZAqlWkP0A-w"
		},
		{
			"key": "user-agent",
			"value": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
			"disabled": true
		},
		{
			"key": "origin",
			"value": "http://localhost:3000",
			"disabled": true
		},
		{
			"key": "sec-fetch-site",
			"value": "cross-site",
			"disabled": true
		},
		{
			"key": "sec-fetch-mode",
			"value": "cors",
			"disabled": true
		},
		{
			"key": "sec-fetch-dest",
			"value": "empty",
			"disabled": true
		},
		{
			"key": "referer",
			"value": "http://localhost:3000/",
			"disabled": true
		},
		{
			"key": "accept-language",
			"value": "en,th-TH;q=0.9,th;q=0.8",
			"disabled": true
		},
		{
			"key": "if-none-match",
			"value": "W/\"5488-ub0gEblfPZbNppLg/Qjuzf9E9U4\"",
			"disabled": true
		}
	],
	"url": {
			"raw": "https://centerapp.io/FileService/getFiles?groupId=xxxxxxxx-2494-4464-901c-b7e5fb53a42a&parent_folder_id=xxxxxxxx-6883-48c7-a318-ae1a92989538&offset=0&limitOfset=30&parentFolderId=xxxxxxxx-6883-48c7-a318-ae1a92989538",
			"protocol": "https",
			"host": [
					"centerapp",
					"io"
				],
			"path": [
					"FileService",
					"getFiles"
				],
			"query": [
				{
					"key": "groupId",
					"value": "xxxxxxxx-2494-4464-901c-b7e5fb53a42a"
				},
				{
					"key": "parent_folder_id",
					"value": "xxxxxxxx-6883-48c7-a318-ae1a92989538"
				},
				{
					"key": "offset",
					"value": "0"
				},
				{
					"key": "limitOfset",
					"value": "30"
				},
				{
					"key": "parentFolderId",
					"value": "xxxxxxxx-6883-48c7-a318-ae1a92989538"
				}
			]
		}
	},
"response": []
}

Download File

API URL: {domain}/FileService/download?fileId=xxx

METHOD: GET

Header:

Authorization : Bearer {token}

Query Params:

fileId

Parameter Desc:

fileId คือ id ของ file ที่จะดาวน์โหลด

Response:

จะได้ stream file

Sample Request:

{
"name": "dowload file",
"request": {
	"method": "GET",
	"header": [],
	"url": {
		"raw": "https://mocha.centerapp.io/FileService/downloadFile?fileId=xxxxxxxx-1986-46c4-80b9-f21cd96e1cd9",
		"protocol": "https",
		"host": [
				"mocha",
				"centerapp",
				"io"
			],
		"path": [
				"FileService",
				"downloadFile"
			],
		"query": [
			{
				"key": "fileId",
				"value": "xxxxxxxx-1986-46c4-80b9-f21cd96e1cd9"
			}
			]
		}
	},
"response": []
}

Move File to Trash

API URL: {domain}/FileService/moveFileToTrash

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Body:

{
    "fileId": "xxxxxxxx-76fa-4aad-997c-5075302269cd"
}

Parameter Desc:

fileId คือ id ของ folder/file ที่จะลบไปยังถังขยะ

Response:

{
    "status": 200,
    "message": "move file to trash:xxxxxxxx-76fa-4aad-997c-5075302269cd successfully"
}

Sample Request:

{
 "name": "moveFileToTrash",
 "request": {
		"method": "POST",
		"header": [
			{
				"key": "Accept",
				"value": "application/json, text/plain, */*"
			},
			{
				"key": "Accept-Language",
				"value": "en,th-TH;q=0.9,th;q=0.8"
			},
			{
				"key": "Authorization",
				"value": "Bearer eyJraWQiOiJpYW0yS2V5SUQiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmaXJzdG5hbWUiOiJ3dXR0aGljaGFpIiwidXNlcl9pZCI6Mjc3MywiZ3JvdXBfaWQiOi0yLCJzeXN0ZW1faWQiOnsiNDEzMCI6eyJyb2xlcyI6WyJjdXNlciJdfX0sImV4cCI6MTY2NjQyNjA3MiwiZW1haWwiOiJ3c2lzb21raHV0MjAwQGdtYWlsLmNvbSIsImxhc3RuYW1lIjoic2lzb21raHV0In0.EeTTWAWI7IfhIf0wXxUaF5wOZ-D0mkg91eT1wNJx2pW6u8MXcorRwnBbJxL1zyPOkeAJOgZ2kiEqJciLy3_ngPmPEibnPzTev4FS4G1v8usjCbuYppO2Qstw73Z2g81y4nQ5j_JdAmbSCmrfO1lfuMKIqyXmi0OYu1BRL_18jXJABo66_Y95wkmsavDeE-akP3Ofkc2Qo9o26RLXxRM3tcuoUxE4nbXtnU7vpyQ1-GCDzsrSFIvwWXVSFqP52HkDvNq0hr9JLZyEBxeJar2zPsLRJmoGWH9xV2QkNXOSdfUpZKyxa8e_-VHSqbtgnbJdmzEYTfWc23CFCgaZqWSM9A"
			},
			{
				"key": "Cache-Control",
				"value": "no-cache"
			},
			{
				"key": "Connection",
				"value": "keep-alive"
			},
			{
				"key": "Content-Type",
				"value": "application/json"
			},
			{
				"key": "Cookie",
				"value": "_ga=GA1.1.1275316013.1665174886; hash=0a3f827a-8a8f-48b5-ad8f-2e2a24c2adda; google_client=901505304449-s5bjapj91t72fuimp0tlq2aubvjicsai.apps.googleusercontent.com; facebook_client=851383785552969; io=EQhPKzX3MJresaf8AAAa; _ga_1LCBB2Q7SS=GS1.1.1666166865.24.1.1666168752.0.0.0"
			},
			{
				"key": "Origin",
				"value": "https://mocha.centerapp.io"
			},
			{
				"key": "Pragma",
				"value": "no-cache"
			},
			{
				"key": "Referer",
				"value": "https://mocha.centerapp.io/center-web/file"
			},
			{
				"key": "Sec-Fetch-Dest",
				"value": "empty"
			},
			{
				"key": "Sec-Fetch-Mode",
				"value": "cors"
			},
			{
				"key": "Sec-Fetch-Site",
				"value": "same-origin"
			},
			{
				"key": "User-Agent",
				"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
			},
			{
				"key": "sec-ch-ua",
				"value": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\""
			},
			{
				"key": "sec-ch-ua-mobile",
				"value": "?0"
			},
			{
				"key": "sec-ch-ua-platform",
				"value": "\"Windows\""
			}
			],
		"body": {
				"mode": "raw",
				"raw": "{\"fileId\":\"xxxxxxxx-1986-46c4-80b9-f21cd96e1cd9\",\"type\":\"FILE\"}"
			},
				"url": {
					"raw": "https://mocha.centerapp.io/FileService/moveFileToTrash",
					"protocol": "https",
					"host": [
						"mocha",
						"centerapp",
						"io"
					],
					"path": [
						"FileService",
						"moveFileToTrash"
					]
				}
			},
	"response": []
}

List Files from Trash

API URL: {domain}/FileService/getFilesInTash?offset=0&limitOfset=30

METHOD: GET

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Query Params:

offset
limitOfset

Parameter Desc:

offset คือ ต่ำแหน่งเริ่มต้นที่จะดึงไฟล์

limitOfset คือ จำนวนการดึงไฟล์

Response:

จะได้ file_app_id และ file_path เพื่อนำมาใช้งานต่อได้

{
    "success": true,
    "message": "get files Successfully.",
    "data": [
        {
            "file_app_id": "xxxxxxxx-f27a-4a16-92b4-bbf0fb903bec",
		...
        },
        {
            "file_app_id": "xxxxxxxx-bf3b-4154-970d-7bcec7bb78be",
		...
        },
        {
            "file_app_id": "xxxxxxxx-1cbd-4330-a1fe-839639b8757d",
		...
        },
        {
            "file_app_id": "xxxxxxxx-d2bf-45a8-9d88-eacf0a613ad4",
		...
        }
    ],
    "total": 4
}

Delete Files from Trash

API URL: {domain}/FileService/deleteFromTrash

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Body:

{
    "fileId": "xxxxxxxx-f27a-4a16-92b4-bbf0fb903bec"
}

Parameter Desc:

fileId คือ id ของ folder/file ที่จะลบออกจากยังถังขยะ

Response:

{
    "status": 200,
    "message": "deleteFromTrash Successfully."
}

Restore Files from Trash

API URL: {domain}/FileService/restore

METHOD: POST

Header:

Authorization : Bearer {token}
Content-Type : application/json; charset=utf-8

Body:

{
    "fileId": "xxxxxxxx-f27a-4a16-92b4-bbf0fb903bec"
}

Parameter Desc:

fileId คือ id ของ folder/file ที่จะ restore ออกจากยังถังขยะ

Response:

{
    "success": true,
    "message": "restore Successfully."
}

Last updated

Was this helpful?