API ReferenceContent

Files

Images, and files uploaded into the file manager.

Prefix /cdna-api/files ReferenceImage model GuideMedia and files
Files in Postman

About files

List images#

GET /cdna-api/files/images

Lists images. Without limit every match comes back.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
Image, in the Reference

Parameters

propertiesquery
selector
The fields and relations to return, such as {id,name,path}.
filtersquery
name=value
Any stored field, or a relation with a dot, such as parent.id=12. Prefix the name with !, >, <, % or |. Use stored field names exactly as in the model, and compare totalCount with the unfiltered list's to confirm a filter applied.
orderByquery
string
field:ASC or field:DESC, comma-separated. Stored fields only.
limitquery
integer
Records per response. There is no default.
offsetquery
integer
Records to skip.

Example

List images
GET /cdna-api/files/images?orderBy=id:DESC&limit=2&properties={id,name,path} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "totalCount": 971,
  "data": [
    {
      "id": 1184,
      "name": null,
      "path": "/files/images/documentation/page/16/code-style-schema.jpg"
    },
    {
      "id": 1183,
      "name": null,
      "path": "/files/images/documentation/global-page/251/Screenshot 2022-09-26 101007.png"
    }
  ]
}
Open in Postman docs Real response from this documentation site

Show an image#

GET /cdna-api/files/image/{id}

Reads one image by its id.

Access
Admin users and integrations, with an OAuth access token or an API key.
Model
Image, in the Reference

Parameters

idpathrequired
integer
The image id.
propertiesquery
selector
The fields and relations to return, such as {id,name,path}.

Example

Show an image
GET /cdna-api/files/image/1184?properties={id,name,path} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "data": {
    "id": 1184,
    "name": null,
    "path": "/files/images/documentation/page/16/code-style-schema.jpg"
  }
}
Open in Postman docs Real response from this documentation site

Upload a file#

POST /cdna-api/files/upload-file

Uploads a file into a folder of the file manager, as a multipart form. type is image for an image.

Access
Admin users and integrations, with an OAuth access token or an API key.
Returns
Not the usual envelope: error (empty on success), type, file and link (the stored path) and the new id.

Parameters

typebody
string
image for an image, otherwise file.
folderbody
string
The folder path in the file manager.
filenamebody
string
The name to store the file under.
fileToUploadbodyrequired
file
The file itself.

Example

Upload a file
POST /cdna-api/files/upload-file HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: multipart/form-data; boundary=----hub

------hub
Content-Disposition: form-data; name="type"

image
------hub
Content-Disposition: form-data; name="folder"

test-from-api
------hub
Content-Disposition: form-data; name="filename"

file-to-upload.png
------hub
Content-Disposition: form-data; name="fileToUpload"

@file
------hub--
Response 200 OK
{
  "error": "",
  "type": "image",
  "file": "/files/test-from-api/file-to-upload.png",
  "link": "/files/test-from-api/file-to-upload.png",
  "id": 23
}
Open in Postman docs Saved response from the Postman collection

In Files