Versionnage d’API
Le versionnage d’API sous ses formes courantes. Le même profil revient sous deux formes : v1 (dépréciée : champs à plat ; envoie les en-têtes Deprecation / Sunset / Link successor-version) et v2 (imbriquée). Choisissez la version par le chemin de l’URL (/api/v1, /api/v2) ou, sur /api/versioned/profile, par l’en-tête X-API-Version, la query ?api-version= ou Accept: application/vnd.apibee.v2+json (vérifiés dans cet ordre).
- GET
https://api.testingapis.com/api/v1/profileGet the profile in the deprecated v1 shape (selected by URL path). - GET
https://api.testingapis.com/api/v2/profileGet the profile in the current v2 shape (selected by URL path). - GET
https://api.testingapis.com/api/versioned/profileGet the profile in the version chosen by header, query string or media type. - GET
https://api.testingapis.com/api/versionsList supported API versions and how to select them.
Exemple de requête
Get the profile in the deprecated v1 shape (selected by URL path). Référence complète et bouton Send (en anglais).
cURL
curl -X GET "https://api.testingapis.com/api/v1/profile"Réponse · 200 OK
{
"id": 101,
"name": "Ava Thompson",
"email": "ava.thompson@example.com",
"phone": "+1-555-0101",
"address": "742 Evergreen Terrace, Springfield, IL 62704, USA",
"memberSince": "2023-04-12"
}