Resource files
This relation targets resource files.
Get all resource files
GET /api/dam/file-resources
The response will contain a paginated list of resource file
resources. Resource file
resources are embedded in the response:
{
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=1&size=20"
},
"curies": [
{
"name": "kpk",
"href": "http://baobab.keepeek.com/api/doc/rels/{rel}",
"templated": true
}
],
"next": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=2&size=20"
},
"last": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=2&size=20"
}
},
"_embedded": {
"file-resource": [
{
"id": "home/background",
"type": "images",
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources/images/home/background"
}
}
},
{
"id": "home/logo",
"type": "images",
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources/images/home/logo"
}
}
}
]
},
"totalCount": 2
}
Possible errors are:
-
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
500
(file-resources-internal-server-error): Internal server error
Get all resource files by type
GET /api/dam/file-resources/images
The response will contain a paginated list of resource file
resources. Resource file
resources are embedded in the response:
{
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=1&size=20"
},
"curies": [
{
"name": "kpk",
"href": "http://baobab.keepeek.com/api/doc/rels/{rel}",
"templated": true
}
],
"next": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=2&size=20"
},
"last": {
"href": "http://baobab.keepeek.com/api/dam/file-resources?page=2&size=20"
}
},
"_embedded": {
"file-resource": [
{
"id": "home/background",
"type": "images",
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources/images/home/background"
}
}
},
{
"id": "home/logo",
"type": "images",
"_links": {
"self": {
"href": "http://baobab.keepeek.com/api/dam/file-resources/images/home/logo"
}
}
}
]
},
"totalCount": 2
}
Possible errors are:
-
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
500
(file-resources-internal-server-error): Internal server error
Get a resource file
GET /api/dam/file-resources/images/home/logo
If the resource file exists, the HTTP status of the response will be 302
. The location of the resource file will be available in the Location
HTTP response header.\ If the resource has several versions, the last version is returned.
(v4.79.0) With versionFileName parameter, we could get a specific version of a resource:
GET /api/dam/file-resources/images/home/logo?versionFileName=logo-sdf65464.jpg
Possible errors are:
-
400
(file-resources-invalid-resource-type): Resource type does not exist -
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
404
(file-resources-not-found): Requested resource file does not exist -
500
(file-resources-internal-server-error): Internal server error
Create a resource file
Header: Content-Type:image/png
POST /api/dam/file-resources/images/home/logo
Request body must contain the resource file to upload in binary format
If the resource file is created with success, the HTTP status of the response will be 201
. It is then possible to get the location of the newly created resource in the Location
HTTP response header.
Possible errors are:
-
400
(file-resources-bad-request): Parameters or body is missing -
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
403
(file-resources-upload-resource-already-exists): Resource file already exists -
413
(file-resources-upload-bad-request-size): File size exceeds maximum size -
415
(file-resources-upload-missing-or-unsupported-content-type): Content type is missing or not supported -
500
(file-resources-internal-server-error): Internal server error
Replace a resource file
Header: Content-Type:image/png
PUT /api/dam/file-resources/images/home/logo
Request body must contain the resource file to upload in binary format
If the resource file is replaced with success, the HTTP status of the response will be 201
. It is then possible to get the location of the replaced resource in the Location
HTTP response header.
(v4.78.0) With version parameter set to true, a new version of resource is created:
PUT /api/dam/file-resources/home/logo?version=true
Possible errors are:
-
400
(file-resources-bad-request): Parameters or body is missing -
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
413
(file-resources-upload-bad-request-size): File size exceeds maximum size -
415
(file-resources-upload-missing-or-unsupported-content-type): Content type is missing or not supported -
500
(file-resources-internal-server-error): Internal server error
Delete a resource file
DELETE /api/dam/file-resources/images/home/logo
If the resource file is deleted with success, the HTTP status of the response will be 204
.
(v4.78.0) With fileNameVersion parameter, we can delete a version of a resource.\ fileNameVersion has to be equal to the complete file name with extension.\ If this parameter is not defined, all versions of the resource are deleted.
DELETE /api/dam/file-resources/images/home/logo?fileNameVersion=logo-ff45z.jpg
Possible errors are:
-
400
(file-resources-invalid-resource-type): Resource type does not exist -
401
(security-notAuthorized): Provided authorization is incomplete or invalid -
403
(file-resources-access-denied): User needs admin access -
404
(file-not-found): only with fileNameVersion parameter -
500
(file-resources-internal-server-error): Internal server error
4.66.0+