PATCH /images/{id}
1 min
PATCH
https://api.cmp.optimizely.com/v3/images/{id}
Path Parameters
- idstringrequiredExampleDescription
Body Parameters
- bodyLibraryImageUpdateRequestrequiredDescription
- titlestringExampleDescriptionMin Length1
- descriptionstringExampleDescriptionMin Length0
- alt_textstringExampleDescriptionMin Length0
- attribution_textstringExampleDescriptionMin Length0
- tagsstring[]Example
[ "dhaka", "new york", "london" ]
Description - is_publicbooleanExampleDescription
- is_archivedbooleanExampleDescription
- allow_se_indexingbooleanExampleDescription
- folder_idstringExampleDescription
- expires_atstring<date-time>ExampleDescriptionFormatdate-time
- labelsResourceLabelRequest[]Description
- groupstringrequiredExampleDescriptionMin Length32Max Length32
- valuesstring[]requiredDescription
- focal_pointobjectExample
{ "x": 35, "y": 75 }Description- xintegerrequiredExampleDescriptionMinimum0Maximum100
- yintegerrequiredExampleDescriptionMinimum0Maximum100
Responses
200
- LibraryImage
- idstringrequiredExampleDescription
- titlestringrequiredExampleDescription
- descriptionstringrequiredExampleDescription
- mime_typestringrequiredExampleDescription
- file_extensionstringrequiredExampleDescription
- created_atstring<date-time>requiredExampleDescriptionFormatdate-time
- modified_atstring<date-time>requiredExampleDescriptionFormatdate-time
- file_sizeintegerrequiredExampleDescription
- image_resolutionobjectrequiredDescription
- heightintegerrequiredExampleDescription
- widthintegerrequiredExampleDescription
- folder_idstringrequiredExampleDescription
- file_locationstringrequiredExampleDescription
- is_archivedbooleanrequiredExampleDescription
- is_publicbooleanrequiredExampleDescription
- allow_se_indexingbooleanrequiredExampleDescription
- urlstringrequiredExampleDescription
- labelsResourceLabelResponse[]requiredDescription
- groupobjectrequiredDescription
- idstringrequiredExampleDescription
- namestringrequiredExampleDescription
- valuesobject[]requiredDescription
- idstringrequiredExampleDescription
- namestringrequiredExampleDescription
- owner_organization_idstringrequiredExampleDescription
- expires_atstring<date-time>requiredExampleDescriptionFormatdate-time
- thumbnail_urlstringrequiredExampleDescription
- version_numberintegerrequiredExampleDescription
- version_idstringrequiredExampleDescription
- alt_textstringrequiredExampleDescription
- tagsTag[]requiredDescription
- guidstringrequiredExampleDescription
- namestringrequiredExampleDescription
- attribution_textstringrequiredExampleDescription
- owner_idstringrequiredExampleDescription
- focal_pointobjectrequiredDescription
- xintegerrequiredExampleDescription
- yintegerrequiredExampleDescription
400
- ErrorExample
{ "message": "Unsupported arguments: a,b,c" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
401
- ErrorExample
{ "message": "Unauthorized" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
403
- ErrorExample
{ "message": "You do not have the permission to perform this operation" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
404
- ErrorExample
{ "message": "Resource not found" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
422
- ErrorExample
{ "message": "Resource cannot be processed" }Description- messagestringrequiredExampleDescription
- errorsmap<string, string>Description
curl
curl --request PATCH \
--url https://api.cmp.optimizely.com/v3/images/{id} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"labels": [
{
"group": "2467e583a60e23fda2b89db81a453cd2",
"values": []
}
],
"focal_point": {
"x": 35,
"y": 75
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"labels": [
{
"group": "2467e583a60e23fda2b89db81a453cd2",
"values": []
}
],
"focal_point": {
"x": 35,
"y": 75
}
});
var requestOptions = {
method: 'PATCH',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.cmp.optimizely.com/v3/images/{id}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.cmp.optimizely.com/v3/images/{id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"labels": [
{
"group": "2467e583a60e23fda2b89db81a453cd2",
"values": []
}
],
"focal_point": {
"x": 35,
"y": 75
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.cmp.optimizely.com/v3/images/{id}"
payload = json.dumps({
"labels": [
{
"group": "2467e583a60e23fda2b89db81a453cd2",
"values": []
}
],
"focal_point": {
"x": 35,
"y": 75
}
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
200
// Updated Image
{
"id": "5d7f910551b00a722e0418830cee6632",
"title": "cat.jpeg",
"description": "Very important image",
"mime_type": "image/jpeg",
"file_extension": "jpg",
"created_at": "2019-10-06T13:15:30Z",
"modified_at": "2019-10-07T13:15:30Z",
"file_size": 11244,
"image_resolution": {
"height": 800,
"width": 700
},
"folder_id": "6bb8db20a5b611ebae319b7c541b1a5a",
"file_location": "/images/",
"is_archived": true,
"is_public": true,
"allow_se_indexing": true,
"url": "http://images.cmp.optimizely.com/Zz0xODQ3NDU3Y2Y2YmYzOTlmNjkyOTgyZDY3Y2I3YWM2OA==",
"labels": [
{
"group": {
"id": "2467e583a60e23fda2b89db81a453cd2",
"name": "Content Format"
},
"values": [
{
"id": "71c378f3fee3d822759d1bdc2aab628c",
"name": "Photos"
}
]
}
],
"owner_organization_id": "5108c3a9becac35915111191",
"expires_at": "2019-10-07T13:15:30Z",
"thumbnail_url": "http://images.cmp.optimizely.com/Zz0xODQ3NDU3Y2Y2YmYzOTlmNjkyOTgyZDY3Y2I3YWM2OA==",
"version_number": 2,
"version_id": "5d7f910551b00a722e0418830cee6631",
"alt_text": "image title",
"tags": [
{
"guid": "5d7f910551b00a722e0418830cee6633",
"name": "Sample Tag"
}
],
"attribution_text": "Nature",
"owner_id": "5108c3a9becac35915111191",
"focal_point": {
"x": 35,
"y": 75
}
}400
// Client error
{
"message": "Not found",
"errors": ""
}401
// Authorization error
{
"message": "Not found",
"errors": ""
}403
// Permission error
{
"message": "Not found",
"errors": ""
}404
// Not found error
{
"message": "Not found",
"errors": ""
}422
// Unprocessable entity error
{
"message": "Not found",
"errors": ""
}