File Actions
https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Below are the various requests that can be performed against the File resource, as well as the expected parameters and the potential responses.
Delete
Deletes a file or directory, if directory all the contents that directory will also be removed.
Method And Url
DELETE https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Authentication
A valid API access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.delete.
Request Path Components
| Path Component | Description | Example | 
|---|---|---|
| APPLICATION_ID | ID associated with the application | 575ec8687ae143cd83dc4a97 | 
| FILE_ID | ID associated with the file | 575ec76c7ae143cd83dc4a96 | 
Request Headers
| Name | Required | Description | Default | 
|---|---|---|---|
| Authorization | Y | The token for authenticating the request, prepended with Bearer | 
Curl Example
curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X DELETE \
    https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Successful Responses
| Code | Type | Description | 
|---|---|---|
| 200 | Success | If file was successfully deleted | 
Error Responses
| Code | Type | Description | 
|---|---|---|
| 400 | Error | Error if malformed request | 
| 404 | Error | Error if file was not found | 
Get
Retrieves information on a file
Method And Url
GET https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Authentication
A valid API access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, file.*, or file.get.
Request Path Components
| Path Component | Description | Example | 
|---|---|---|
| APPLICATION_ID | ID associated with the application | 575ec8687ae143cd83dc4a97 | 
| FILE_ID | ID associated with the file | 575ec76c7ae143cd83dc4a96 | 
Request Headers
| Name | Required | Description | Default | 
|---|---|---|---|
| Authorization | Y | The token for authenticating the request, prepended with Bearer | 
Curl Example
curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Successful Responses
| Code | Type | Description | 
|---|---|---|
| 200 | File Schema | file information | 
Error Responses
| Code | Type | Description | 
|---|---|---|
| 400 | Error | Error if malformed request | 
| 404 | Error | Error if file was not found | 
Move
Move a file or the entire contents of a directory
Method And Url
POST https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID/move
Authentication
A valid API access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.move.
Request Path Components
| Path Component | Description | Example | 
|---|---|---|
| APPLICATION_ID | ID associated with the application | 575ec8687ae143cd83dc4a97 | 
| FILE_ID | ID associated with the file | 575ec76c7ae143cd83dc4a96 | 
Request Query Parameters
| Name | Required | Description | Default | Example | 
|---|---|---|---|---|
| name | N | The new name of the file or directory | name=fileA | |
| parentDirectory | N | The new parent directory for the file or directory to move into. | parentDirectory=/new/location/here | 
Request Headers
| Name | Required | Description | Default | 
|---|---|---|---|
| Authorization | Y | The token for authenticating the request, prepended with Bearer | 
Curl Example
curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID/move
Successful Responses
| Code | Type | Description | 
|---|---|---|
| 201 | File Schema | Returns a new file or directory that was created by the move, if a directory a job will kick off to move all the directories children. | 
Error Responses
| Code | Type | Description | 
|---|---|---|
| 400 | Error | Error if malformed request | 
| 404 | Error | Error if file was not found | 
Patch
Reupload a file
Method And Url
PATCH https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Authentication
A valid API access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.patch.
Request Path Components
| Path Component | Description | Example | 
|---|---|---|
| APPLICATION_ID | ID associated with the application | 575ec8687ae143cd83dc4a97 | 
| FILE_ID | ID associated with the file | 575ec76c7ae143cd83dc4a96 | 
Request Headers
| Name | Required | Description | Default | 
|---|---|---|---|
| Authorization | Y | The token for authenticating the request, prepended with Bearer | 
Request Body
The body of the request should be serialized JSON that validates against the File Patch schema. For example, the following would be a valid body for this request:
{
  "fileSize": 500,
  "contentType": "image",
  "fileDimensions": {
    "width": 200,
    "height": 200
  }
}
Curl Example
curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"fileSize":500,"contentType":"image","fileDimensions":{"width":200,"height":200}}' \
    https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID
Successful Responses
| Code | Type | Description | 
|---|---|---|
| 201 | File Upload Post Response | Successfully updated file and returned a post url to respond with | 
Error Responses
| Code | Type | Description | 
|---|---|---|
| 400 | Error | Error if malformed request | 
| 404 | Error | Error if file was not found | 
Upload
Uploads the file
Method And Url
POST https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID/upload
Authentication
A valid API access token is required to access this endpoint. The token must
include at least one of the following scopes:
all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, file.*, or file.upload.
Request Path Components
| Path Component | Description | Example | 
|---|---|---|
| APPLICATION_ID | ID associated with the application | 575ec8687ae143cd83dc4a97 | 
| FILE_ID | ID associated with the file | 575ec76c7ae143cd83dc4a96 | 
Request Headers
| Name | Required | Description | Default | 
|---|---|---|---|
| Authorization | Y | The token for authenticating the request, prepended with Bearer | 
Request Body
The body of the request should be a multipart form data post containing the following:
| Name | Required | Description | Default | Example | 
|---|---|---|---|---|
| file | Y | The content of the file to upload | `` | 
Curl Example
curl -H 'Content-Type: multipart/form-data' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -F file=@localfilename' \
    https://api.app.wnology.io/applications/APPLICATION_ID/file/FILE_ID/upload
Successful Responses
| Code | Type | Description | 
|---|---|---|
| 200 | File Schema | Updated file content | 
Error Responses
| Code | Type | Description | 
|---|---|---|
| 400 | Error | Error if malformed request | 
| 404 | Error | Error if file was not found | 
Schemas
Error
Schema for errors returned by the API
Error Schema
- ▶{} 3 keys
- "http://json-schema.org/draft-07/schema#"
 - "object"
 - ▶{} 2 keys
- ▶{} 1 key
 - ▶{} 1 key
 
 
 
Error Example
- ▶{} 2 keys
- "NotFound"
 - "Application was not found"
 
 
File Schema
Schema for a single file
File Schema Schema
- ▶{} 3 keys
- "http://json-schema.org/draft-07/schema#"
 - "object"
 - ▶{} 16 keys
- ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 3 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 1 key
 - ▶{} 1 key
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 1 key
 
 
 
File Schema Example
- ▶{} 12 keys
- "575ec8687ae143cd83dc4a97"
 - "575ec8687ae143cd83dc4a97"
 - "2016-06-13T04:00:00.000Z"
 - "2016-06-13T04:00:00.000Z"
 - "575ed70c7ae143cd83dc4aa9"
 - "user"
 - "pending"
 - "file.csv"
 - "file"
 - "/"
 - 500
 - "text/csv"
 
 
File Patch
Schema to patch a file
File Patch Schema
- ▶{} 3 keys
- "http://json-schema.org/draft-07/schema#"
 - "object"
 - ▶{} 3 keys
- ▶{} 1 key
 - ▶{} 2 keys
 - ▶{} 2 keys
 
 
 
File Patch Example
- ▶{} 3 keys
- 500
 - "image"
 - ▶{} 2 keys
 
 
File Upload Post Response
Schema to upload the file to s3
File Upload Post Response Schema
- ▶{} 3 keys
- "http://json-schema.org/draft-07/schema#"
 - "object"
 - ▶{} 14 keys
- ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 3 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 1 key
 - ▶{} 2 keys
 - ▶{} 2 keys
 - ▶{} 2 keys
 
 
 
File Upload Post Response Example
- ▶{} 13 keys
- "575ec8687ae143cd83dc4a97"
 - "575ec8687ae143cd83dc4a97"
 - "2016-06-13T04:00:00.000Z"
 - "2016-06-13T04:00:00.000Z"
 - "575ed70c7ae143cd83dc4aa9"
 - "user"
 - "pending"
 - "file.csv"
 - "file"
 - "/"
 - 500
 - "text/csv"
 - ▶{} 2 keys
 
 
Success
Schema for reporting a successful operation
Success Schema
- ▶{} 3 keys
- "http://json-schema.org/draft-07/schema#"
 - "object"
 - ▶{} 1 key
- ▶{} 2 keys
 
 
 
Success Example
- ▶{} 1 key
- true
 
 
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.