How to Insert a YouTube Video

To insert a YouTube video into a collection, make a POST request to the /v1/resource/insert/ endpoint with the required parameters in the body. The resource should be a valid YouTube URL and make sure you use the youtube type.

Request Example

from wetro import Wetrocloud
    
# Initialize the Wetrocloud client
client = Wetrocloud(api_key="your_api_key")
    
# Insert a YouTube video into a Collection
insert_response = client.collection.insert_resource(
    collection_id="my_unique_collection_id",
    resource="https://youtu.be/dQw4w9WgXcQ?si=0QKWYSM2QB03PoMh", 
    type="youtube"
)
    
print(insert_response)

Successful Response

A successful response confirms the operation and tracks token usage.

Example Response

{
  "resource_id": "79621681-b680-4918-948d-d7f8c482426a",
  "success": true,
  "tokens": 35
}
FieldDescription
successIndicates whether the resource was inserted successfully.
tokensNumber of tokens consumed during the operation.
resource_idUnique ID for the resource, this is required when removing a resource