Vessel API Python SDK
The Vessel API Python SDK is a PyPi library for accessing the Vessel API, a Unified CRM API that provides standardized endpoints for performing operations on common CRM Objects.
SDK Installation
pip install vesselapi
SDK Example Usage
Example
import vesselapi
from vesselapi.models import operations
s = vesselapi.VesselAPI()
req = operations.DeleteConnectionRequestBody(
connection_id='string',
)
res = s.connections.delete(req, operations.DeleteConnectionSecurity(
vessel_api_token="<YOUR_API_KEY_HERE>",
))
if res.status_code == 200:
pass
Authentication
To authenticate the Vessel Node SDK you will need to provide a Vessel API Token, along with an Access Token for each request. For more details please see the Vessel API Documentation.
Available Resources and Operations
- delete - Delete Connection
- find - Get Connection
- list - Get All Connections
- list - Get CRM Integrations
- batch - Get Batch Event Attendees
- create - Create Event Attendee
- details - Get Event Attendee Details
- find - Get Event Attendee
- list - Get All Event Attendees
- search - Search Event Attendees
- update - Update Event Attendee
- create - Exchange Public Token for Access Token
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
Error Object | Status Code | Content Type |
---|
errors.SDKError | 400-600 | / |
Example
import vesselapi
from vesselapi.models import operations
s = vesselapi.VesselAPI()
req = operations.DeleteConnectionRequestBody(
connection_id='string',
)
res = None
try:
res = s.connections.delete(req, operations.DeleteConnectionSecurity(
vessel_api_token="<YOUR_API_KEY_HERE>",
))
except errors.SDKError as e:
print(e)
raise(e)
if res.status_code == 200:
pass
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the server_idx: int
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables |
---|
0 | https://api.vessel.land | None |
Example
import vesselapi
from vesselapi.models import operations
s = vesselapi.VesselAPI(
server_idx=0,
)
req = operations.DeleteConnectionRequestBody(
connection_id='string',
)
res = s.connections.delete(req, operations.DeleteConnectionSecurity(
vessel_api_token="<YOUR_API_KEY_HERE>",
))
if res.status_code == 200:
pass
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the server_url: str
optional parameter when initializing the SDK client instance. For example:
import vesselapi
from vesselapi.models import operations
s = vesselapi.VesselAPI(
server_url="https://api.vessel.land",
)
req = operations.DeleteConnectionRequestBody(
connection_id='string',
)
res = s.connections.delete(req, operations.DeleteConnectionSecurity(
vessel_api_token="<YOUR_API_KEY_HERE>",
))
if res.status_code == 200:
pass
Custom HTTP Client
The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session
object.
For example, you could specify a header for every request that this sdk makes as follows:
import vesselapi
import requests
http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = vesselapi.VesselAPI(client: http_client)
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|
vessel_api_token | apiKey | API key |
You can set the security parameters through the security
optional parameter when initializing the SDK client instance. For example:
import vesselapi
from vesselapi.models import operations, shared
s = vesselapi.VesselAPI(
security=shared.Security(
vessel_api_token="<YOUR_API_KEY_HERE>",
),
)
req = operations.GetOneConnectionRequest(
connection_id='string',
)
res = s.connections.find(req)
if res.response_body is not None:
pass
Per-Operation Security Schemes
Some operations in this SDK require the security scheme to be specified at the request level. For example:
import vesselapi
from vesselapi.models import operations
s = vesselapi.VesselAPI()
req = operations.DeleteConnectionRequestBody(
connection_id='string',
)
res = s.connections.delete(req, operations.DeleteConnectionSecurity(
vessel_api_token="<YOUR_API_KEY_HERE>",
))
if res.status_code == 200:
pass