API Usage Examples
Table of Contents
Complete Subscriber Provisioning
This example demonstrates the complete workflow for provisioning a new subscriber from scratch. The process involves creating all required profiles and components before creating the subscriber.
Prerequisites: This example uses jq for JSON parsing. Install with apt-get install jq or brew install jq.
Related Sections:
# 1. Create Key Set
KEY_SET_ID=$(curl -k -X POST https://hss.example.com:8443/api/key_set \
-H "Content-Type: application/json" \
-d '{
"key_set": {
"ki": "0123456789ABCDEF0123456789ABCDEF",
"opc": "FEDCBA9876543210FEDCBA9876543210",
"authentication_algorithm": "milenage"
}
}' | jq -r '.data.id')
# 2. Create APN QoS Profile
APN_QOS_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/qos_profile \
-H "Content-Type: application/json" \
-d '{
"apn_qos_profile": {
"name": "Default Internet QoS",
"qci": 9,
"allocation_retention_priority": 8,
"apn_ambr_dl_kbps": 50000,
"apn_ambr_ul_kbps": 25000
}
}' | jq -r '.data.id')
# 3. Create APN Identifier
APN_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/identifier \
-H "Content-Type: application/json" \
-d '{
"apn_identifier": {
"apn": "internet",
"ip_version": 2
}
}' | jq -r '.data.id')
# 4. Create APN Profile
APN_PROFILE_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/profile \
-H "Content-Type: application/json" \
-d "{
\"apn_profile\": {
\"name\": \"Internet APN\",
\"apn_identifier_id\": $APN_ID,
\"apn_qos_profile_id\": $APN_QOS_ID
}
}" | jq -r '.data.id')
# 5. Create EPC Profile
EPC_PROFILE_ID=$(curl -k -X POST https://hss.example.com:8443/api/epc/profile \
-H "Content-Type: application/json" \
-d '{
"epc_profile": {
"name": "Standard Data Plan",
"ue_ambr_dl_kbps": 100000,
"ue_ambr_ul_kbps": 50000
}
}' | jq -r '.data.id')
# 6. Create Subscriber
SUBSCRIBER_ID=$(curl -k -X POST https://hss.example.com:8443/api/subscriber \
-H "Content-Type: application/json" \
-d "{
\"subscriber\": {
\"imsi\": \"001001123456789\",
\"key_set_id\": $KEY_SET_ID,
\"epc_profile_id\": $EPC_PROFILE_ID
}
}" | jq -r '.data.id')
echo "Subscriber provisioned successfully with ID: $SUBSCRIBER_ID"
What This Creates:
This provisioning workflow creates a complete subscriber with:
- Cryptographic keys (Key Set) - For authentication
- Data service profile (EPC Profile) - Bandwidth and network access settings
- APN configuration (APN Profile) - Access point with QoS
- Subscriber record (Subscriber) - The actual subscriber entity
Next Steps:
- Add phone numbers: See MSISDN Management
- Enable voice services: Create and assign IMS Profile
- Configure roaming: Create and assign Roaming Profile
- Link physical SIM: Create and assign SIM
See Also:
- Multi-MSISDN Documentation - Assigning multiple phone numbers
- Profiles Documentation - Advanced profile configuration
Complete Static IP Provisioning
This example demonstrates provisioning a subscriber with a static IP address from scratch.
Scenario: Provision an IoT device subscriber that needs a static IPv4 address on the "internet" APN.
# Prerequisites: jq must be installed (apt-get install jq or brew install jq)
# 1. Create Key Set
KEY_SET_ID=$(curl -k -X POST https://hss.example.com:8443/api/key_set \
-H "Content-Type: application/json" \
-d '{
"key_set": {
"ki": "0123456789ABCDEF0123456789ABCDEF",
"opc": "FEDCBA9876543210FEDCBA9876543210",
"authentication_algorithm": "milenage"
}
}' | jq -r '.data.id')
# 2. Create APN QoS Profile
APN_QOS_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/qos_profile \
-H "Content-Type: application/json" \
-d '{
"apn_qos_profile": {
"name": "IoT Best Effort",
"qci": 9,
"allocation_retention_priority": 8,
"apn_ambr_dl_kbps": 10000,
"apn_ambr_ul_kbps": 5000
}
}' | jq -r '.data.id')
# 3. Create APN Identifier
APN_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/identifier \
-H "Content-Type: application/json" \
-d '{
"apn_identifier": {
"apn": "internet",
"ip_version": 0
}
}' | jq -r '.data.id')
# 4. Create APN Profile
APN_PROFILE_ID=$(curl -k -X POST https://hss.example.com:8443/api/apn/profile \
-H "Content-Type: application/json" \
-d "{
\"apn_profile\": {
\"name\": \"IoT Internet APN\",
\"apn_identifier_id\": $APN_ID,
\"apn_qos_profile_id\": $APN_QOS_ID
}
}" | jq -r '.data.id')
# 5. Create Static IP for the APN
STATIC_IP_ID=$(curl -k -X POST https://hss.example.com:8443/api/epc/static_ip \
-H "Content-Type: application/json" \
-d "{
\"static_ip\": {
\"apn_profile_id\": $APN_PROFILE_ID,
\"ipv4_static_ip\": \"100.64.1.100\"
}
}" | jq -r '.data.id')
# 6. Create EPC Profile
EPC_PROFILE_ID=$(curl -k -X POST https://hss.example.com:8443/api/epc/profile \
-H "Content-Type: application/json" \
-d '{
"epc_profile": {
"name": "IoT Data Plan",
"ue_ambr_dl_kbps": 10000,
"ue_ambr_ul_kbps": 5000
}
}' | jq -r '.data.id')
# 7. Create MSISDN (phone number)
MSISDN_ID=$(curl -k -X POST https://hss.example.com:8443/api/msisdn \
-H "Content-Type: application/json" \
-d '{
"msisdn": {
"msisdn": "14155551000"
}
}' | jq -r '.data.id')
# 8. Create Subscriber with Static IP
SUBSCRIBER_ID=$(curl -k -X POST https://hss.example.com:8443/api/subscriber \
-H "Content-Type: application/json" \
-d "{
\"subscriber\": {
\"imsi\": \"001001999999999\",
\"key_set_id\": $KEY_SET_ID,
\"epc_profile_id\": $EPC_PROFILE_ID,
\"msisdns\": [$MSISDN_ID],
\"static_ips\": [$STATIC_IP_ID]
}
}" | jq -r '.data.id')
echo "IoT Subscriber provisioned successfully!"
echo " Subscriber ID: $SUBSCRIBER_ID"
echo " IMSI: 001001999999999"
echo " MSISDN: 14155551000"
echo " Static IPv4: 100.64.1.100 (on 'internet' APN)"
What This Creates:
This provisioning workflow creates a complete IoT subscriber with:
- Cryptographic keys (Key Set) - For authentication
- APN configuration (APN Profile) - "internet" access point
- Static IP assignment (Static IP) - Fixed IPv4 address 100.64.1.100
- Data service profile (EPC Profile) - IoT-optimized bandwidth limits
- Phone number (MSISDN) - For device identification
- Subscriber record (Subscriber) - The complete subscriber entity
Result:
When this subscriber attaches to the network and connects to the "internet" APN, they will receive the static IP address 100.64.1.100 instead of a dynamic DHCP address.
Next Steps:
- Add additional APNs with static IPs: Repeat steps 2-5 for each APN
- Enable voice services: Create and assign IMS Profile
- Configure roaming: Create and assign Roaming Profile
- Link physical SIM: Create and assign SIM
See Also:
- Static IP Management - Detailed static IP documentation
- Complete Subscriber Provisioning - Basic provisioning without static IP
- Multi-MSISDN Documentation - Assigning multiple phone numbers