Overview
This guide covers the complete lifecycle of mobile app management in Bit2Connect, from creation to deletion, using the Public API.
Creating Mobile Apps
iOS App Example
curl -X POST "https://api.bit2connect.com/1.0/mobile-apps" \
-H "X-API-KEY: b2co_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"platform": "IOS",
"name": "My iOS App",
"bundleId": "com.mycompany.myapp",
"appStoreFallback": "https://apps.apple.com/app/id123456789",
"appStoreId": "123456789",
"iosMinVersion": "14.0"
}'
Android App Example
curl -X POST "https://api.bit2connect.com/1.0/mobile-apps" \
-H "X-API-KEY: b2co_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"platform": "ANDROID",
"name": "My Android App",
"packageName": "com.mycompany.myapp",
"playStoreFallback": "https://play.google.com/store/apps/details?id=com.mycompany.myapp",
"androidMinVersion": "21"
}'
Listing Mobile Apps
Retrieve all mobile apps in your project:
curl -X GET "https://api.bit2connect.com/1.0/mobile-apps" \
-H "X-API-KEY: b2co_your_api_key"
The response includes both iOS and Android apps with platform-specific fields:
{
"success": true,
"data": {
"apps": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My iOS App",
"platform": "IOS",
"bundleId": "com.mycompany.myapp",
"appStoreFallback": "https://apps.apple.com/app/id123456789",
"appStoreId": "123456789",
"iosMinVersion": "14.0",
"packageName": null,
"playStoreFallback": null,
"androidMinVersion": null
},
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"name": "My Android App",
"platform": "ANDROID",
"bundleId": null,
"appStoreFallback": null,
"appStoreId": null,
"iosMinVersion": null,
"packageName": "com.mycompany.myapp",
"playStoreFallback": "https://play.google.com/store/apps/details?id=com.mycompany.myapp",
"androidMinVersion": "21"
}
],
"total": 2
}
}
Updating Mobile Apps
Update specific fields of an existing mobile app:
curl -X PUT "https://api.bit2connect.com/1.0/mobile-apps/550e8400-e29b-41d4-a716-446655440000" \
-H "X-API-KEY: b2co_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"appStoreFallback": "https://apps.apple.com/app/id987654321",
"appStoreId": "987654321"
}'
Partial Updates: You only need to include the fields you want to change. The platform cannot be modified after creation.
Deleting Mobile Apps
Remove a mobile app from your project:
curl -X DELETE "https://api.bit2connect.com/1.0/mobile-apps/550e8400-e29b-41d4-a716-446655440000" \
-H "X-API-KEY: b2co_your_api_key"
Impact on Links: Deleting a mobile app will remove its association from any dynamic links currently using it. The links will continue to work but will lose their mobile app configuration.
Integration Workflows
Workflow 1: Pre-register Apps
- Create mobile apps for your iOS and Android applications
- Save the app IDs returned from the API
- Create dynamic links using the saved app IDs
// Step 1: Create mobile apps
const iosApp = await createMobileApp({
platform: 'IOS',
name: 'My iOS App',
bundleId: 'com.mycompany.myapp',
appStoreFallback: 'https://apps.apple.com/app/id123456789'
});
const androidApp = await createMobileApp({
platform: 'ANDROID',
name: 'My Android App',
packageName: 'com.mycompany.myapp',
playStoreFallback: 'https://play.google.com/store/apps/details?id=com.mycompany.myapp'
});
// Step 2: Create links using saved apps
const link = await createLink({
payload: {
link: 'https://yourapp.com/content',
iosAppId: iosApp.data.id,
androidAppId: androidApp.data.id
}
});
Workflow 2: Save During Link Creation
Create and save mobile app configurations while creating dynamic links:
const link = await createLink({
payload: {
link: 'https://yourapp.com/content',
ios: {
bundleId: 'com.mycompany.myapp',
app_store_fallback: 'https://apps.apple.com/app/id123456789',
saveApp: true,
appName: 'My iOS App'
},
android: {
package: 'com.mycompany.myapp',
store_fallback: 'https://play.google.com/store/apps/details?id=com.mycompany.myapp',
saveApp: true,
appName: 'My Android App'
}
}
});
Error Handling
Common error scenarios and how to handle them:
App Not Found
{
"success": false,
"error": "Mobile app not found",
"timestamp": "2024-01-15T12:00:00Z"
}
Validation Errors
{
"success": false,
"error": "Validation failed",
"details": [
"bundleId is required for iOS apps",
"appStoreFallback must be a valid URL"
],
"timestamp": "2024-01-15T12:00:00Z"
}
{
"success": false,
"error": "Cannot change platform after creation",
"timestamp": "2024-01-15T12:00:00Z"
}
Next Steps