This version of the Library API (v4) only supports the creation of a library through the Create Library endpoint. Use the Library API (api2) for all other library-related tasks.
Use the Library API, which is a versioned API, to perform the following tasks:
Endpoint | Description |
---|---|
POST /libraries
|
Creates a library. |
The Library API uses our standard API authentication.
Use the following base URL:
Creates a library.
Request syntax:
Request body parameters:
Pass the following request body parameters:
Name |
Data Type |
Description |
---|---|---|
allow_copy |
Boolean |
Determines whether you may copy the assets associated with this library. Default value: False
|
desc Required |
String |
Defines the library's name. |
is_ad |
Boolean |
Determines whether this library may only contain ad assets. Default value: False
|
Pass a digital signature based off of msg.
The response for a successful request contains the following properties:
Name |
Data Type |
Description |
---|---|---|
@id |
String |
Indicates the relative path that returns this resource. |
@type |
String |
Returns Library. |
allow_copy |
Boolean |
Indicates whether you may copy the assets associated with this library. |
desc |
String |
Indicates the library's name. |
id |
String |
Identifies this library by its system-defined ID. |
is_ad |
Boolean |
Indicates whether this library may only contain ad assets. |
library_type |
String |
Returns Owner which indicates that you own this library. |
owner_name |
String |
Indicates the email address associated with your user account. |
Call the create_library module (Python 3) to create a library. This module imports names from the api_auth module.
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 = "{}{}".format(self.host, "/api/v4/libraries") description = 'My Library' # Replace with the desired name. payload = { 'desc': description } 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()
Response:
{ '@id': '/api/v4/libraries//8b69f969c65e481385281331520cf1e2', '@type': 'Library', 'id': '8b69f969c65e481385281331520cf1e2', 'desc': 'My Library', 'owner_name': 'joe@example.com', 'library_type': 'owner', 'is_ad': False, 'allow_copy': False }