How to Integrate Using Python SDK
Verizon ThingSpace API Sample App Guide (v1)
Overview
The Verizon ThingSpace API Sample App is a open-source Python web application that demonstrates how to integrate with Verizon's ThingSpace IoT platform. This sample app provides developers with a practical example of authenticating with the ThingSpace API, managing device activations, retrieving service plans, and accessing device information. Feel free to modify and extend this open-source application to suit your needs.
Target Audience: Developers building IoT applications that need to integrate with Verizon's ThingSpace platform for device management and connectivity services.
Key Use Cases
- IoT Device Onboarding: Streamline the process of activating new devices on the Verizon network
- Service Plan Management: Query and manage connectivity service plans for your IoT devices
- Device Monitoring: Retrieve real-time device information and status updates
- API Integration Testing: Test ThingSpace API endpoints before implementing in production applications
Quick Start
Prerequisites
Before running the sample app, ensure you have:
- Python 3.8 or higher installed
- Verizon ThingSpace API credentials (API key and secret)
- A Verizon ThingSpace developer account
- Git for cloning the repository
Get Running in 3 Steps
- Try the Live Demo: Visit the sandbox environment to explore the app's functionality immediately
- Clone and Setup: Follow the installation steps below to run locally
- Configure API Keys: Add your ThingSpace credentials to start making real API calls
Links
View on GitHub
Access the complete source code, contribute to the project, or report issues.
🚀 Try Live Demo
Explore the sample app in action with our hosted sandbox environment. Test all features without local setup.
Features
Authentication Management
- Session Token Retrieval: Secure authentication flow with ThingSpace API
- Access Token Handling: Automatic token refresh and management
- Credential Validation: Built-in validation for API keys and secrets
Device Operations
- Device Activation: Activate IoT devices on the Verizon network
- Device Information Retrieval: Access detailed device status, connectivity info, and metadata
- Bulk Device Management: Handle multiple devices efficiently
Service Plan Management
- Plan Listing: Retrieve available service plans for your account
- Plan Details: Access pricing, data limits, and feature information
- Account Integration: Seamlessly integrate with your ThingSpace account
User Interface
- Intuitive Web Interface: Clean, responsive design for easy navigation
- Real-time Updates: Live status updates for API operations
- Error Handling: Clear error messages and troubleshooting guidance
Setup & Installation
1. Clone the Repository
git clone https://github.com/verizonlabs/thingspace-sample-app.git
cd verizon-sample-app2. Install Dependencies
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install required packages
pip install -r requirements.txt3. Configure Environment Variables
Create a .env file in the project root:
VERIZON_API_KEY=your_api_key_here
VERIZON_API_SECRET=your_api_secret_here
VERIZON_BASE_URL=https://thingspace.verizon.com
DEBUG=False4. Run the Application
# Start the development server
python app.py
# Access the app at http://localhost:5000Usage
Getting Started with the Sample App
- Launch the Application: Start the local server or use the sandbox environment
- Authenticate: Enter your ThingSpace API credentials to obtain session and access tokens
- Explore Features: Navigate through the different sections to test API functionality
Example Workflows
Activating a New Device
- Navigate to the "Device Activation" section
- Enter device details (IMEI, ICCID, etc.)
- Select appropriate service plan
- Click "Activate Device" to process the request
- Monitor activation status in real-time
Retrieving Service Plans
- Access the "Service Plans" section
- Click "Load Plans" to fetch available options
- Review plan details including data limits and pricing
- Use plan IDs for device activation or management
Checking Device Information
- Go to "Device Information" section
- Enter device identifier (IMEI or device ID)
- View comprehensive device details including:
- Connection status
- Data usage
- Location information
- Service plan details
Customization
Extending the Sample App
Add New API Endpoints: The modular structure allows easy integration of additional ThingSpace API endpoints:
# Example: Add location tracking endpoint
@app.route('/device/location')
def get_device_location():
# Implement location tracking logic
passCustom UI Components: Modify the templates to match your application's branding and user experience requirements.
Database Integration: Add persistent storage for device information, usage history, or user preferences.
Configuration Options
- API Timeout Settings: Adjust request timeout values in
config.py - Logging Levels: Customize logging verbosity for development or production
- UI Themes: Modify CSS files to implement custom styling
Troubleshooting
Common Issues
Authentication Errors
- Problem: "Invalid API credentials" or "Authentication failed"
- Solution: Verify your API key and secret are correct and have proper permissions
- Check: Ensure your ThingSpace account has API access enabled
Connection Timeouts
- Problem: API requests timing out or failing
- Solution: Check your internet connection and ThingSpace service status
- Workaround: Increase timeout values in the configuration
Device Activation Failures
- Problem: Device activation returns error codes
- Solution: Verify device IMEI/ICCID format and ensure device is compatible with selected service plan
- Debug: Check device eligibility in ThingSpace console
Missing Dependencies
- Problem: ImportError or ModuleNotFoundError
- Solution: Run
pip install -r requirements.txtto install all dependencies - Environment: Ensure you're using the correct Python version (3.8+)
Debugging Tips
- Enable debug mode by setting
DEBUG=Truein your environment variables - Check application logs for detailed error information
- Use the sandbox environment to test API calls without affecting production data
- Verify API rate limits aren't being exceeded
Support
Contributing
We welcome contributions to improve the sample app:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request with detailed description
Reporting Issues
If you encounter bugs or have feature requests, please open an issue on the GitHub Issues page
Version Information
- Current Version: v1.2.0
- Python SDK Version: verizon-sdk v2.1.0
- Last Updated: March 2024
- Compatibility: Python 3.8+, ThingSpace API v2.0

