Libraries operations

Get a collection of libraries

To get all libraries, you must execute a GET request to the following endpoint:

{baseurl}/api/default/{media}

Where media is the libraries’ entity set, for example – albums or videolibraries.

Sample request

GET http://mysite.com/api/default/videolibraries

Sample response

This request queries all available libraries and their child folders recursively.

NOTE: If in the request you do not specify a site, a culture, or a data provider, the libraries that are queried are taken from the default data provider and default culture of the default site in the system.

Get a specific library

To get a single library, you must execute a GET request to the following endpoint:

{baseurl}/api/default/{media}({id})

Where:

  • media is the library’s entity set, for example – albums or videolibraries
  • id is the ID of the library that you want to get, for example – d4e22033-7bcd-4ce5-9c70-41f9b83d7d66

Sample request

GET http://mysite.com/api/default/videolibraries(d4e22033-7bcd-4ce5-9c70-41f9b83d7d66)

Sample response

Create a library

To create a library, you must execute a POST request to the following endpoint:

{baseurl}/api/default/{media}

Where media is the library’s entity set, for example – albums or videolibraries.

Sample request

POST http://mysite.com/api/default/videolibraries

Sample response

If you make the same request as above, but you change the verb to PUT, the server responds with the following error:

Partially update a library

Updating a library can be done in two ways – with a PATCH or with a PUT request. The difference between the two verbs is that PATCH allows for a partial update, whereas PUT requires all fields to be present in the request’s body.

To partially update a library, you must execute a PATCH request to the following endpoint:

{baseurl}/api/default/{media}({id})

Where:

  • media is the library’s entity set, for example – albums or videolibraries
  • id is the ID of the library that you want to update, for example – d4e22033-7bcd-4ce5-9c70-41f9b83d7d66

Sample request

PATCH http://misite.com/api/default/videolibraries(d4e22033-7bcd-4ce5-9c70-41f9b83d7d66)

Sample response

Fully update of a library

Updating a library can be done in two ways – with a PATCH or with a PUT request. The difference between the two verbs is that PATCH allows for a partial update, whereas PUT requires all fields to be present in the request’s body.

To update a library, you must execute a PUT request to the following endpoint:

{baseurl}/api/default/{media}({id})

Where:

  • media is the library’s entity set, for example – albums or videolibraries
  • id is the ID of the library that you want to update, for example – d4e22033-7bcd-4ce5-9c70-41f9b83d7d66

NOTE: You can get an error, if one or more properties of the library are not included in the request’s body.

Sample request

PUT http://mysite.com/api/default/videolibraries(d4e22033-7bcd-4ce5-9c70-41f9b83d7d66)

Sample response

Sample request (all required properties)

PUT http://mysite.com/api/default/videolibraries(d4e22033-7bcd-4ce5-9c70-41f9b83d7d66)

Sample response

No response body

Delete a library

To delete a library, you must execute a DELETE request to the following endpoint:

{baseurl}/api/default/{media}({id})

Where:

  • media is the library’s entity set, for example – albums or videolibraries
  • id is the ID of the library that you want to delete, for example – d4e22033-7bcd-4ce5-9c70-41f9b83d7d66

Sample request

DELETE http://mysite.com/api/default/videolibraries(d4e22033-7bcd-4ce5-9c70-41f9b83d7d66)

Sample response

No response body

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Folders operations