Vendors Resource
API methods for vendors operations.
Methods
create
Create Vendor Create a new vendor.
This endpoint creates a new vendor in the Credo AI vendor registry.
Method: POST
Path: /vendors
# Create Vendor
from credoai.models import VendorCreate
data = VendorCreate(
# Add required fields here
)
response = client.vendors.create(
data=data,
)
Parameters
Request Body: VendorCreate
Responses
201 - Successful Response
- Content-Type:
application/json - Schema:
VendorResponse
422 - Validation Error
- Content-Type:
application/json - Schema:
HTTPValidationError
list
List Vendors List all vendors.
This endpoint retrieves all vendors with optional pagination. Returns a paginated response with items and pagination metadata.
Method: GET
Path: /vendors
# List Vendors
response = client.vendors.list(
)
Parameters
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
page_limit | Any | ✗ | - |
page_after | Any | ✗ | - |
Responses
200 - Successful Response
- Content-Type:
application/json - Schema:
PaginatedResponse_VendorResponse_
422 - Validation Error
- Content-Type:
application/json - Schema:
HTTPValidationError
get
Get Vendor Get a vendor by ID.
This endpoint retrieves an existing vendor by its ID.
Method: GET
Path: /vendors/{vendor_id}
# Get Vendor
vendor_id = "example" # Path parameter
response = client.vendors.get(
vendor_id=vendor_id,
)
Parameters
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
vendor_id | str | ✓ | - |
Responses
200 - Successful Response
- Content-Type:
application/json - Schema:
VendorResponse
422 - Validation Error
- Content-Type:
application/json - Schema:
HTTPValidationError
update
Update Vendor Update an existing vendor.
This endpoint updates an existing vendor with the provided data. Only the fields provided in the request will be updated.
Method: PATCH
Path: /vendors/{vendor_id}
# Update Vendor
from credoai.models import VendorUpdate
vendor_id = "example" # Path parameter
data = VendorUpdate(
# Add required fields here
)
response = client.vendors.update(
vendor_id=vendor_id,
data=data,
)
Parameters
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
vendor_id | str | ✓ | - |
Request Body: VendorUpdate
Responses
200 - Successful Response
- Content-Type:
application/json - Schema:
VendorResponse
422 - Validation Error
- Content-Type:
application/json - Schema:
HTTPValidationError
delete
Delete Vendor Delete a vendor by ID.
This endpoint deletes an existing vendor by its ID.
Method: DELETE
Path: /vendors/{vendor_id}
# Delete Vendor
vendor_id = "example" # Path parameter
response = client.vendors.delete(
vendor_id=vendor_id,
)
Parameters
Path Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
vendor_id | str | ✓ | - |
Responses
204 - Successful Response
422 - Validation Error
- Content-Type:
application/json - Schema:
HTTPValidationError
Usage Examples
Here's a complete example using the create method:
import asyncio
from credoai import
from credoai.models import VendorCreate
async def main():
# Initialize client
client = (
base_url="https://api.credo.ai",
api_key="test_password-your-api-key"
)
try:
# Create Vendor
data = VendorCreate(
# Add required fields here
)
response = await client.vendors.create(data=data)
print(f"Success: {response}")
except Exception as e:
print(f"Error: {e}")
finally:
await client.close()
# Run the example
asyncio.run(main())
Error Handling
All methods in this resource can raise the following exceptions:
ValidationError- Invalid request dataAPIError- Server-side errorsAuthenticationError- Invalid or missing API keyNotFoundError- Resource not found (404)RateLimitError- Too many requests
from credoai.errors import APIError, ValidationError
try:
response = client.vendors.create()
except ValidationError as e:
print(f"Invalid request: {e}")
except APIError as e:
print(f"API error {e.status_code}: {e.message}")