OpenFIT API Migration Guide
Overview: This guide will help you migrate from the old API (openfitapi.groupnos.com) to the new OpenFit API infrastructure.
Estimated Time: 1-2 hours of development work
Impact: Authentication method changes; API endpoints remain the same
Step 1: Update Your Configuration
Test Environment URLs
API_URL: https://of-api-internal.azurewebsites.net/
Production Environment URLs
API_URL: https://api.openfit.care
Action Items:
- Update configuration files with new URLs
- Ensure separate variables for ID_SERVER_URL and API_URL
- Test migration in test environment first before production
Step 2: Update Authentication (Token Acquisition)
NEW: Initial Token Request
The authentication now uses a separate identity server URL.
var options = new RestClientOptions("ID_SERVER_URL");
var client = new RestClient(options);
var request = new RestRequest("/connect/token", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "password");
request.AddParameter("scope", "OpenFitApi offline_access");
request.AddParameter("client_id", "099153c2625149bc8ecb3e85e03f0022");
request.AddParameter("username", "<<username/email>>");
request.AddParameter("password", "<<user_password>>");
RestResponse response = await client.ExecuteAsync(request);
Response includes:
access_token
refresh_token
expires_in
(timeout duration)
Action Items:
- Update authentication code to use ID_SERVER_URL
- Store both access_token and refresh_token from response
- Note the token expiration time
Step 3: Implement Token Refresh
NEW: Refresh Token Request
When your access_token expires (HTTP 401 response), use the refresh token:
var options = new RestClientOptions("ID_SERVER_URL");
var client = new RestClient(options);
var request = new RestRequest("/connect/token", Method.Post);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "refresh_token");
request.AddParameter("refresh_token", "<<refresh_token_from_result>>");
RestResponse response = await client.ExecuteAsync(request);
Action Items:
- Implement HTTP 401 interceptor/handler
- Add automatic token refresh logic
- Update stored access_token when refreshed
Step 4: Update API Base URL
Change API Calls
All existing API endpoint methods remain the same, only the base URL changes.
Action Items:
- Update all API calls from
openfitapi.groupnos.com
toAPI_URL
- Verify all existing endpoints still work with new base URL
Step 5: Testing Checklist
Test Environment Testing
- Successfully authenticate and receive tokens
- Make a sample API call using new endpoints
- Verify token refresh works when access_token expires
- Test data synchronization with historical data (August onwards)
Production Deployment
- Switch production configuration to production URLs
- Monitor first successful authentication
- Verify data sync resumes
- Confirm historical data (August-present) syncs correctly
Step 6: Verification
Post-Migration Checks:
- Data synchronization active and current
- Historical data from August onwards successfully transmitted
- No authentication errors in logs
- Token refresh mechanism working properly
Reference
Swagger Documentation: Visit the https://api.openfit.care in your browser to access full API endpoint documentation
Support Contact: Available for immediate technical support call
Questions During Migration? Contact the OpenFIT team immediately - we're standing by to help.
Quick Reference: What Changed
Aspect | Old API | New API |
---|---|---|
Base URL | openfitapi.groupnos.com | api.openfit.care (prod) |
Authentication | Single URL | Separate ID_SERVER_URL |
Token Type | Basic | OAuth2 with refresh tokens |
Endpoints | ✓ Same | ✓ Same |
Methods | ✓ Same | ✓ Same |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article