Media items
A media item is an uploaded asset, plus the description and metadata associated with it. It aligns with the data model. You can use query attributes with media items. Before you start working with media items, you must authenticate.
The base URL for uploading media assets is https://mms-upload.sitecorecloud.io
and the base URL for retrieving media assets is https://mms-delivery.sitecorecloud.io
. For a full list of fields, parameters, and technical limitations, see the data model.
Search and filter parameters are applicable when working with the Delivery API only.
Get a list of media items
Use this method to retrieve a list of media items. If you don't specify any filtering parameters, you will retrieve all available media items.
GET {Base URL}/api/content/v1/media
Request
This code sample lists all media items.
GET {Base URL}/api/content/v1/media
GET {Base URL}/api/content/v1/media?pageNumber=1&pageSize=1
Example of an ID query:
GET {Base URL}/api/content/v1/items?id=MR60hv5QGkupyb2NNRJRmA|whxmR9vzrUeVoT-umLxuNQ|MR60hv5QGkupyb2NNRJRcF
Example of a search query:
GET {Base URL}/api/content/v1/items?pageNumber=1&pageSize=10&search=hotel
Example of a sortBy query:
GET {Base URL}/api/content/v1/items?pageNumber=1&pageSize=10&sortBy=system.updatedAt
Response
{
"totalCount": 20,
"pageSize": 1,
"pageNumber": 1,
"data": [
{
"id": "GGp18w-IlkuCtj7A3G0i3g",
"name": "ONEDERLUST logo",
"description": "",
"file": {
"name": null,
"type": "image/png",
"size": 4984,
"link": {
"type": "Link",
"relatedType": "File",
"id": "eae2e642ab564a53a58b0a1df4f8468a",
"uri": "https://mms-delivery-staging.sitecore-staging.cloud/api/media/v2/delivery/2646a967-f206-420a-a26d-08db60f70205/eae2e642ab564a53a58b0a1df4f8468a"
},
"dimensions": {
"width": 512,
"height": 54
}
},
"system": {
"lastPublishProgress": {
"type": "Publish",
"status": "Completed",
"triggeredBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"triggeredAt": "2023-06-12T18:32:07.5326643Z"
},
"type": "Media",
"version": "qecHTVZ1bh6BBcS7lrNzN06ZIgui6zLhx4pUd9VppaQ=",
"status": "Published",
"createdBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"createdAt": "2023-06-12T18:31:21.0978878Z",
"updatedBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"updatedAt": "2023-06-12T18:33:10.0717148Z",
"publishedBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"publishedAt": "2023-06-12T18:33:10.0710026Z"
}
}
]
}
Get a media item using the ID
Use this method to retrieve a media item with a specific ID. You can also retrieve a list of IDs. For a list of media item IDs, run the GET api/content/v1/types method or open the media item details page.
GET {Base URL}/api/content/v1/media/{mediaId}
GET {Base URL}/api/content/v1/media?id={mediaId1}|{mediaId2}|{mediaId3}
Request
This code sample returns a media item with the ID of travelJapan2Weeks.
The ID is a unique identifier that is auto-generated for the media item you want to create. You cannot change the ID.
GET {Base URL}/api/content/v1/media/travelJapan2Weeks
Response
{
"id": "travelJapan2Weeks",
"name": "Japan for 2 weeks ",
"description": "Enjoy a beautiful two-week tour of Japan.",
"file": {
"name": null,
"type": "image/jpeg",
"size": 415462,
"link": {
"type": "Link",
"relatedType": "File",
"id": "f2f232e53743492e8101f1e30e0795a7",
"uri": "https://mms-delivery.sitecore.cloud.io/api/media/v2/delivery/2646a967-f206-420a-a26d-08db60f70205/f2f232e53743492e8101f1e30e0795a7"
},
"dimensions": {
"width": 1360,
"height": 910
}
},
"system": {
"lastPublishProgress": {
"type": "Publish",
"status": "Completed",
"triggeredBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"triggeredAt": "2023-06-09T18:50:45.3227325Z"
},
"type": "Media",
"version": "W/mdEuGAAHFZ8hfm6R8srrOdg8HV+1EShopdVoVJQ48=",
"status": "Published",
"createdBy": null,
"createdAt": "2023-06-08T13:14:56.2041932Z",
"updatedBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"updatedAt": "2023-06-09T18:51:46.6998798Z",
"publishedBy": {
"type": "Link",
"relatedType": "User",
"id": "thomas.louis@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/thomas.louis@sitecore.com"
},
"publishedAt": "2023-06-09T18:51:46.69835Z"
}
}
Create a media item
Use this method to create a media item.
POST {Base URL}/api/content/v1/media
Request
This code sample creates a media item:
POST {Base URL}/api/content/v1/media
{
"name": "Istanbul",
"description": "Enjoy the beauty and colors of Istanbul.",
"fileId": ""
}
Response
{
"id": "VZNOogNe_EagoOi3Dx9YgQ",
"name": "Istanbul",
"description": "Enjoy the beauty and colors of Istanbul.",
"file": null,
"system": {
"lastPublishProgress": null,
"type": "Media",
"version": "Wc6p9e1Oe/X3ehNerdJELRw0KJ9lJTM2puck/oO6tCY=",
"status": "Draft",
"createdBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"createdAt": "2023-06-13T10:51:48.9901577Z",
"updatedBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"updatedAt": "2023-06-13T10:51:48.9901577Z",
"publishedBy": null,
"publishedAt": null
}
}
Update a media item
Use this method to update the description for a media item with a specific ID.
Request
This code sample updates the description of the media item with the ID VZNOogNe_EagoOi3Dx9YgQ.
PUT {Base URL}/api/content/v1/media/VZNOogNe_EagoOi3Dx9YgQ
{
"name": "Istanbul",
"description": "Enjoy the beauty and colors of Istanbul. Come visit us!",
"fileId": ""
}
You can use query attributes with media items.
Response
{
"id": "VZNOogNe_EagoOi3Dx9YgQ",
"name": "Istanbul",
"description": "Enjoy the beauty and colors of Istanbul. Come visit us!",
"file": null,
"system": {
"lastPublishProgress": null,
"type": "Media",
"version": "kABaRTfzC2ejImrvn8u80wzF30WyH1dz6L7qAqra7xE=",
"status": "Draft",
"createdBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"createdAt": "2023-06-13T10:51:48.9901577Z",
"updatedBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"updatedAt": "2023-06-13T10:59:19.8166903Z",
"publishedBy": null,
"publishedAt": null
}
}
Get all references to a media item
Use this method to get a list of all content items that reference a specific media item.
Request
This code sample retrieves all the items that reference the media item with the ID travelLuxuryInn.
GET {Base URL}/api/content/v1/media?linkedTo=travelLuxuryInn
Response
{
"totalCount": 1,
"pageSize": 20,
"pageNumber": 1,
"data": [
{
"system": {
"updatedAt": "2023-09-15T17:36:53.8382887Z",
"contentType": {
"type": "Link",
"relatedType": "ContentType",
"id": "hotels",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/types/hotels"
},
"lastPublishProgress": {
"type": "Publish",
"status": "Completed",
"triggeredBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"triggeredAt": "2023-09-15T17:37:06.0646689Z"
},
"type": "Content",
"version": "Vfn2miqzk6NkMPjBL64+MXDt2hQWUUoVf485WKwMijI=",
"status": "Published",
"createdBy": {
"type": "Link",
"relatedType": "User",
"id": "",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/"
},
"createdAt": "2023-06-08T13:15:03.6540984Z",
"updatedBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"publishedBy": {
"type": "Link",
"relatedType": "User",
"id": "suzie.q@sitecore.com",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/users/suzie.q@sitecore.com"
},
"publishedAt": "2023-09-15T17:38:06.9267629Z"
},
"id": "luxuryInn",
"name": "Luxury-Inn",
"fields": {
"industry": {
"value": "travel",
"type": "ShortText"
},
"shortDescription": {
"value": "Luxury-Inn is a highly esteemed hotel with a long history and impressive design. It first opened in 1913 and has since undergone modern updates while still maintaining its grand and elegant style. The hotel offers top-notch amenities, including a spa with an infinity pool, a tea room, and a sauna. With 42 suites to choose from, the Royal Suite stands out as the most lavish option, spanning 320 square meters. ",
"type": "LongText"
},
"description": {
"value": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "As a strong contender for the grandest hotel, Luxury-Inn boasts a rich history and stunning décor combined with first rate amenities. This establishment originally opened its doors in 1913 and although the amenities have been modernised over the years, much of the imposing and regal style has been preserved. The spa is the perfect place to unwind in style as it comes complete with an infinity edged swimming pool, a team room and a sauna. There are 42 different suites to choose from, which the 320 square metre Royal Suite being the grandest of them all. "
}
]
}
]
},
"type": "RichText"
},
"pricePerNight": {
"value": 100,
"type": "Integer"
},
"ratingstars": {
"value": 4,
"type": "Integer"
},
"amenities": {
"value": [
{
"id": "airConditioning"
},
{
"id": "wifi"
},
{
"id": "wheelchairAccessible"
}
],
"type": "Select"
},
"roomType": {
"value": [],
"type": "Select"
},
"relatedItems": {
"value": [
{
"type": "Link",
"relatedType": "Content",
"id": "japan",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/items/japan"
}
],
"type": "Reference"
},
"heroImage": {
"value": [
{
"type": "Link",
"relatedType": "Media",
"id": "travelLuxuryInn",
"uri": "http://content-api.sitecore.cloud.io/api/content/v1/media/travelLuxuryInn"
}
],
"type": "Media"
}
}
}
]
}
Delete a media item
Use this method to delete a media item with a specific ID. If the media item is published, you must unpublish it first.
DELETE {Base URL}/api/content/v1/media/{mediaId}
Request
This code sample deletes a media item with the ID MR60hv5QGkupyb2NNRJRmA.
DELETE {Base URL}/api/content/v1/media/MR60hv5QGkupyb2NNRJRmA
You can use query attributes with media items.
Publish a media item
Use this method to publish a specific media item.
POST {Base URL}/api/content/v1/media/{mediaId}
Request
This code sample publishes a media item with the ID MR60hv5QGkupyb2NNRJRmA.
POST {Base URL}/api/content/v1/media/MR60hv5QGkupyb2NNRJRmA/publish
Unpublish a media item
Use this method to unpublish a specific media item.
DELETE {Base URL}/api/content/v1/media/{mediaId}/publish
Request
This code sample unpublishes a media item with the ID MR60hv5QGkupyb2NNRJRmA.
DELETE {Base URL}/api/content/v1/media/MR60hv5QGkupyb2NNRJRmA/publish