Get eSIM activation code
curl --request GET \
--url https://api.withallo.com/v2/api/partner/esims/{id}/activation_code \
--header 'Authorization: <api-key>'import requests
url = "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.withallo.com/v2/api/partner/esims/{id}/activation_code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.withallo.com/v2/api/partner/esims/{id}/activation_code")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v2/api/partner/esims/{id}/activation_code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"lpa": "LPA:1$smdp.example.com$ABCD-1234-EFGH-5678",
"smdp_address": "smdp.example.com",
"matching_id": "ABCD-1234-EFGH-5678",
"qr_code": "data:image/png;base64,iVBORw0KGgo..."
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {}
}{
"error": {}
}{
"error": {}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {}
}Partner
Obtenir le code d'activation d'une eSIM
Returns the activation code of a ready eSIM: the LPA string, the SM-DP+ address, the matching id and a QR code. Before the eSIM is ready, the request fails with ESIM_NOT_READY. Requires the PARTNER scope.
GET
/
v2
/
api
/
partner
/
esims
/
{id}
/
activation_code
Get eSIM activation code
curl --request GET \
--url https://api.withallo.com/v2/api/partner/esims/{id}/activation_code \
--header 'Authorization: <api-key>'import requests
url = "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.withallo.com/v2/api/partner/esims/{id}/activation_code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.withallo.com/v2/api/partner/esims/{id}/activation_code"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.withallo.com/v2/api/partner/esims/{id}/activation_code")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v2/api/partner/esims/{id}/activation_code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"lpa": "LPA:1$smdp.example.com$ABCD-1234-EFGH-5678",
"smdp_address": "smdp.example.com",
"matching_id": "ABCD-1234-EFGH-5678",
"qr_code": "data:image/png;base64,iVBORw0KGgo..."
}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {}
}{
"error": {}
}{
"error": {}
}{
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"request_id": "<string>",
"retry_after_seconds": 123
}
}{
"error": {}
}Scope requis :
PARTNERlpa), ses deux parties (smdp_address et matching_id) et un QR code. Tant que l’eSIM n’est pas prête, la requête échoue avec 409 ESIM_NOT_READY. Attendez le webhook partner.esim.ready, ou le statut ACTIVE sur Obtenir une eSIM.
Le code d’activation n’est jamais envoyé dans un webhook. Récupérez-le au moment de remettre l’eSIM à votre client.
Toute personne qui installe l’eSIM avec ce code prend le contrôle de la ligne. Envoyez-le uniquement à votre client.
Champs de la réponse
| Champ | Description |
|---|---|
lpa | Le code d’activation complet, au format LPA:1$<smdp_address>$<matching_id> |
smdp_address | L’adresse SM-DP+, pour la saisie manuelle |
matching_id | Le code d’activation, pour la saisie manuelle |
qr_code | Une data URI PNG d’un QR code qui encode lpa. Utilisez-la comme src d’une balise <img>. |
Comment remettre l’eSIM à votre client
Donnez à votre client l’une de ces options, selon son téléphone :- QR code : affichez
qr_code. Votre client le scanne depuis les réglages eSIM de son téléphone. - Android, saisie manuelle : donnez
smdp_addressetmatching_id. Votre client les saisit dans les réglages eSIM de son téléphone. - iPhone (iOS 17.4 et versions ultérieures), lien d’installation : construisez un lien à partir de
lpa. Votre client l’ouvre sur l’iPhone et l’eSIM s’installe en un geste.
https://esimsetup.apple.com/esim_qrcode_provisioning?carddata= suivi de lpa encodé pour une URL. Les caractères $ et : doivent être encodés.
- JavaScript
- Python
const { lpa } = activationCode;
const link =
"https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=" +
encodeURIComponent(lpa);
from urllib.parse import quote
lpa = activation_code["lpa"]
link = "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=" + quote(lpa, safe="")
Erreurs
| Code | Signification |
|---|---|
ESIM_NOT_READY | L’eSIM n’est pas encore prête à installer. Toujours retryable: true. |
PARTNER_ESIM_NOT_FOUND | Aucune eSIM avec cet id n’a été commandée sur un compte créé par votre clé API. |
ESIM_UNAVAILABLE | Le code d’activation ne peut pas être lu pour le moment. Réessayez plus tard. |
Cette page vous a-t-elle été utile ?