Working with Files

Overview

Storing files such as PDF, JPEG, PNG, etc. is supported in CoverGo system.

Upload Files

A POST request should be made to https://api.covergo.com/api/v1/files/{sub-directory}/ for file uploading.

form-dataDescription
filefile in form of binary
isPublicwhether the file is publicly accessible

Download Files

To download a file, a GET request could be made to https://api.covergo.com/api/v1/files/{sub-directory}/{url-encoded-file-name}.

eg. If a file with file name "test image.png" was uploaded to https://api.covergo.com/api/v1/files/photos/, it could be downloaded by making a GET request to https://api.covergo.com/api/v1/files/photos/test%20image.png.

Delete Files

Deletion of files is done through GraphQL:

mutation deleteFile(
  $key: String!
){
  deleteFile(
    key: $key
  ){
    status 
    errors 
    errors_2 { message }
  }
}

Input:

{
  "key": "<SUB_DIRECTORY>/<FILE_NAME>"
}

Example Result:

{
  "data": {
    "deleteFile": {
      "status": "success",
      "errors": null,
      "errors_2": null
    }
  }
}