Getting Started
Learn how to get started with the Vertex API
Table of Contents
1. Prerequisites
Before connecting to the Vertex API, ensure you have:
- NATS Credentials File (.creds): Contains your NATS JWT from SAVA and your locally generated seed. Follow the Authentication documentation to:
- Generate NKEY pair locally with
nsc generate nkey -u
- Share your public key with SAVA
- Receive NATS JWT from SAVA
- Create your .creds file
- Generate NKEY pair locally with
- NATS Client: Install a NATS client library for your programming language. NATS supports various languages, including JavaScript, Python, Go, Java, and more.
Key Point: The Vertex API uses a single JWT system. The NATS JWT in your .creds file provides complete authentication - no additional tokens or authentication steps are needed.
2. Connecting to the Vertex API
2.1 Connection URLs
To connect to the Vertex API, you'll need to use the following NATS URL:
- Public URL:
wss://hermes.sava.africa
This URL is sufficient for establishing a connection to the Vertex API.
2.2 Basic Connection Steps
- Install a NATS Client:
Choose and install a NATS client library that's compatible with your programming language and environment.
- Visit NATS Clients for a list of available client libraries.
- Establish a Connection:
Use your NATS client to connect to one of the provided URLs.
Note: The exact code will vary depending on your chosen programming language and NATS client library.
Once authenticated, you can use the following connection configuration:
Connection configuration(javascript)import { connect } from 'nats';
// Connect using credentials file
const nc = await connect({
servers: ["nats://hermes.sava.africa"],
credentials: "/path/to/your.creds" // Contains NATS JWT and seed
}); - Authenticate:
Authentication is handled through the .creds file which contains:
- The NATS JWT received from SAVA
- Your NKEY seed generated locally
See the Authentication section for details on obtaining these credentials.
- Start Making API Calls:
After successful connection, you can start making API calls to the various Vertex API services.
Remember to handle connection errors and implement reconnection logic as needed for production environments.
For more detailed information on using specific API endpoints, please refer to the individual service documentation sections.
Complete Example
Here's a complete example showing how to connect and make API calls:
import { connect } from 'nats';
import { UserService } from './generated/UserService';
// Connect using .creds file (contains NATS JWT from SAVA)
const nc = await connect({
servers: ["nats://hermes.sava.africa"],
credentials: "/path/to/your.creds"
});
// Make API calls using this authenticated connection
// The NATS JWT in your .creds file provides all necessary authentication
const partnerId = "your-partner-id";
const userService = new UserService(nc, partnerId);
// Example API call
try {
const response = await userService.listUsers({
entity_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log('Users:', response.users);
} catch (error) {
console.error('Error:', error);
}
Remember to handle connection errors and implement reconnection logic as needed for production environments.
For more detailed information on using specific API endpoints, please refer to the individual service documentation sections.