How to Insert a Web Resource

To insert a web resource (like a website or webpage) 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 URL and make sure you use the web type.

Request Example

from wetro import Wetrocloud
    
# Initialize the Wetrocloud client
client = Wetrocloud(api_key="your_api_key")
    
# Insert a web resource into a Collection
insert_response = client.collection.insert_resource(
    collection_id="my_unique_collection_id",
    resource="https://medium.com/@AlexanderObregon/a-brief-history-of-artificial-intelligence-1656693721f9#:~:text=In%20this%20article%2C%20we%20explore,learning%20are%20breaking%20new%20ground.", 
    type="web"
)
    
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