Create Library

Creates a new library for organizing assets.

Endpoint

POST /libraries

Request Parameters

Pass the following request body parameters:

NameData TypeRequiredDescription
descStringYesDefines the library's name.
allow_copyBooleanNoDetermines whether assets in this library can be copied. Default: False.
is_adBooleanNoSpecifies if this library may only contain ad assets. Default: False.

Example Request

{
  "desc": "Marketing Library",
  "allow_copy": true,
  "is_ad": false
}

Response

A successful request returns the following:

NameData TypeDescription
@idStringRelative path to retrieve this resource.
@typeStringReturns Library.
idStringSystem-defined identifier for the library.
descStringLibrary name.
owner_nameStringEmail associated with the library owner.
library_typeStringIndicates owner if you created this library.
is_adBooleanIndicates if this library contains only ad assets.
allow_copyBooleanIndicates if assets can be copied.

Sample Code

import json
import requests
from api_auth import APICredentials, APIParams

class Create_Library:
    def __init__(self):
        self.host = "https://services.uplynk.com"
    
    def run(self):
        self._create_library()

    def _create_library(self):
        url = f"{self.host}/api/v4/libraries"
        payload = {
            "desc": "Marketing Library",
            "allow_copy": True,
            "is_ad": False
        }
        headers = {'Content-Type': 'application/json'}
        
        response = requests.post(
            url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers
        )
        
        print(response.json())

Create_Library().run()

Sample Response

{
  "@id": "/api/v4/libraries/8b69f969c65e481385281331520cf1e2",
  "@type": "Library",
  "id": "8b69f969c65e481385281331520cf1e2",
  "desc": "Marketing Library",
  "owner_name": "[email protected]",
  "library_type": "owner",
  "is_ad": false,
  "allow_copy": true
}