PUT Modify PCR Profile
This endpoint updates the Policy and Charging Rules (PCR) profile for a specific SIM card including data, voice, SMS, and wallet configurations.
Configure the API Endpoint
Danger: Modifying a PCR profile incorrectly can lead to poor performance or service suspension. Always double-check the parameters before making a request.
https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/{iccid}
- Method:
PUT
Set Up the Headers
| Param | Value | Description |
|---|---|---|
| Content-Type | application/json | Specifies the payload format. |
| x-api-key | {{x-api-key}} | Your unique API key for secure access. |
| x-user-id | {{x-user-id}} | Your user identifier for added security and tracking. |
Path Parameters
| Param | Type | Required | Description |
|---|---|---|---|
| iccid | string | required | The ICCID of the SIM card |
Request Body
Warning: Any mistakes in the request payload can result in failed updates. Follow the specified format carefully.
{
"data": {
"state": "ENABLED",
"active_throttling": "SPEED_1000_KBPS"
},
"voice": {
"state": "ENABLED"
},
"sms": {
"state": "DISABLED"
},
"wallet_mode": "SIM",
"route_policy": 1
}
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
| data.state | string | required when data object provided | Desired state (ENABLED, DISABLED) |
| data.active_throttling | string | optional | Throttling speed (NO_LIMIT, SPEED_100_KBPS, SPEED_500_KBPS, SPEED_1000_KBPS, SPEED_2000_KBPS, SPEED_3000_KBPS, SPEED_5000_KBPS) |
| voice.state | string | required when voice object provided | Voice service state (ENABLED, DISABLED) |
| sms.state | string | required when sms object provided | SMS service state (ENABLED, DISABLED) |
| wallet_mode | string | optional | Wallet usage mode (GROUP, SIM) |
| route_policy | integer | optional | Route policy for network signal handling |
Example Response
Status Code: 204 No Content
The PCR profile has been updated successfully. No response body is returned.
Code Snippets
Note: Use these code snippets to integrate the API calls into your system effectively. Adapt them as necessary to fit your application's needs.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
curl --location --request PUT 'https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/{{iccid}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--header 'x-user-id: {{x-user-id}}' \
--data '{
"data": {
"state": "ENABLED",
"active_throttling": "SPEED_1000_KBPS"
}
}'
import http.client
import json
conn = http.client.HTTPSConnection("esim.betatel.com")
payload = json.dumps({
"data": {
"state": "ENABLED",
"active_throttling": "SPEED_1000_KBPS"
}
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-api-key': '{{x-api-key}}',
'x-user-id': '{{x-user-id}}'
}
iccid = "example_iccid"
conn.request("PUT", f"/api/v1/esim/sim-pcr-profiles/{iccid}", payload, headers)
res = conn.getresponse()
print(res.status, res.reason)
const axios = require('axios');
const iccid = "example_iccid";
const data = {
data: {
state: "ENABLED",
active_throttling: "SPEED_1000_KBPS"
}
};
axios.put(`https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/${iccid}`, data, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-api-key': '{{x-api-key}}',
'x-user-id': '{{x-user-id}}'
}
})
.then((response) => {
console.log(response.status);
})
.catch((error) => {
console.log(error);
});
<?php
$curl = curl_init();
$iccid = "example_iccid";
$data = json_encode([
"data" => [
"state" => "ENABLED",
"active_throttling" => "SPEED_1000_KBPS"
]
]);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/$iccid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Content-Type: application/json',
'x-api-key: {{x-api-key}}',
'x-user-id: {{x-user-id}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
HttpResponse<String> response = Unirest.put("https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/{iccid}")
.header("Content-Type", "application/json")
.header("x-api-key", "{{x-api-key}}")
.header("x-user-id", "{{x-user-id}}")
.body("{\"data\":{\"state\":\"ENABLED\",\"active_throttling\":\"SPEED_1000_KBPS\"}}").asString();
System.out.println(response.getStatus());
var client = new HttpClient();
var iccid = "example_iccid";
var data = new StringContent(JsonConvert.SerializeObject(new {
data = new {
state = "ENABLED",
active_throttling = "SPEED_1000_KBPS"
}
}), Encoding.UTF8, "application/json");
var request = new HttpRequestMessage(HttpMethod.Put, $"https://esim.betatel.com/api/v1/esim/sim-pcr-profiles/{iccid}")
{
Content = data
};
request.Headers.Add("Accept", "application/json");
request.Headers.Add("x-api-key", "{{x-api-key}}");
request.Headers.Add("x-user-id", "{{x-user-id}}"
var response = await client.SendAsync(request);
Console.WriteLine(response.StatusCode);
Error Handling
Important: Pay attention to status codes. A '400' indicates invalid input, while a '401' suggests authentication problems.
- 400 - Bad Request - Invalid input parameters or malformed request
- 401 - Unauthorized - Authentication failure