Versions et évolutions
L'API évolue par ajouts. Quand une opération doit changer de façon incompatible, l'ancien comportement reste disponible par un en-tête daté, il est annoncé dans le journal des changements, et il dure au moins six mois.
D'abord des ajouts
Les chemins ne portent jamais de numéro de version. Ces changements arrivent à tout moment, sans préavis, et ne doivent pas casser votre intégration :
- une nouvelle opération ou une nouvelle ressource ;
- un nouveau paramètre ou en-tête facultatif ;
- un nouveau champ dans une réponse ;
- une nouvelle valeur d'énumération ;
- un nouveau code d'erreur, ou un nouveau membre dans le
contextd'une erreur.
Donc : ignorez les champs que vous ne connaissez pas, acceptez les valeurs d'énumération inconnues, et repliez-vous sur le statut HTTP pour un code d'erreur inconnu (voir Conventions).
Tout le reste est un changement incompatible :
retirer ou renommer un champ, changer son type ou son sens, rendre un
paramètre obligatoire, changer le statut d'un code. Ceux-là passent
par Myle-API-Version.
Myle-API-Version
CLI
#!/usr/bin/env bash
# versioning-header: the myle CLI (key from `myle login` or MYLE_API_KEY).
# The CLI always sends a Myle-API-Version: by default the date it was built against,
# so upgrading the CLI is how you move to newer behaviors.
myle version # the CLI's version and its Myle-API-Version
myle me --version 2026-12-01 # another date, for one call
myle config --set api_version 2026-12-01 # or pinned for the project
HTTP
Myle-API-Version: 2026-12-01
TypeScript
import { API_VERSION, Myle } from '@myleapp/myle';
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
const myle = new Myle({ apiVersion: '2026-12-01' });
console.log(`built against ${API_VERSION}`);
await myle.me.get();
Python
from myle import API_VERSION, Myle
# The SDK always sends a Myle-API-Version: by default the date it was generated against,
# so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
myle = Myle(api_version="2026-12-01")
print(f"built against {API_VERSION}")
myle.me.get()
Go
package main
import (
"context"
"fmt"
"log"
myle "github.com/myleapp/myle-go"
)
func main() {
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
client := myle.NewClient(myle.WithAPIVersion("2026-12-01"))
fmt.Println("built against", myle.APIVersion)
if _, err := client.Me.Get(context.Background()); err != nil {
log.Fatal(err)
}
}
Java
import fr.myleapp.myle.MyleClient;
public class Example {
public static void main(String[] args) {
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
MyleClient client = MyleClient.builder().apiVersion("2026-12-01").build();
System.out.println("built against " + MyleClient.API_VERSION);
client.me().get();
}
}
Scala
import fr.myleapp.myle.{MyleClient, MyleConfig, Version}
object VersioningHeader {
def main(args: Array[String]): Unit = {
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
val myle = MyleClient(MyleConfig(apiVersion = "2026-12-01"))
println(s"built against ${Version.api}")
myle.me.get()
}
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Myle\Client;
use Myle\Version;
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
$myle = new Client(apiVersion: '2026-12-01');
echo 'built against ', Version::API_VERSION, "\n";
$myle->me->get();
C#
using Myle;
// The SDK always sends a Myle-API-Version: by default the date it was generated against,
// so upgrading the SDK is how you move to newer behaviors. Pin another date explicitly:
using var client = new MyleClient(new MyleClientOptions { ApiVersion = "2026-12-01" });
Console.WriteLine($"built against {MyleClient.DefaultApiVersion}");
await client.Me.GetAsync();
-
La valeur est une date,
YYYY-MM-DD: le contrat sur lequel votre intégration a été construite et testée. - Absente, vous recevez le comportement le plus récent de chaque opération. Cela convient à un essai rapide avec curl, pas à une intégration en production : un changement incompatible l'atteindrait le jour même de sa sortie.
- Présente, chaque opération applique son comportement le plus récent daté de votre date ou d'avant.
-
Une date antérieure au plus ancien comportement qu'une opération
prend encore en charge, ou une valeur qui n'est pas une date,
répond
400 core.api-version-unsupported, avec le minimum danscontext.minimum. - Une opération qui n'a jamais changé de façon incompatible ignore l'en-tête. C'est le cas courant.
En production, envoyez toujours
Myle-API-Version, à la date de votre dernier
test. Avancez-la quand vous avez lu le journal des changements et
adapté votre code. Les SDK officiels envoient la date du document de
l'API à partir duquel ils sont générés.
En-têtes de dépréciation et de retrait
Quand votre date reçoit un ancien comportement, la réponse le dit, avec la date du changement qui l'a remplacé et l'endroit où le lire :
CLI
#!/usr/bin/env bash
# versioning-deprecation: the myle CLI (key from `myle login` or MYLE_API_KEY).
# When the API serves a call with an older behavior, the CLI prints a warning on stderr
# (`--log-level error` silences it; with --format json it is off unless --log-level warn, then a JSON line):
# warning: GET /me answered with the deprecated behavior of Myle-API-Version 2026-12-01, served until …
myle me --version 2026-12-01
HTTP
HTTP/1.1 201 Created
Myle-API-Version: 2026-12-01
Deprecation: @1803859200
Sunset: Wed, 01 Sep 2027 00:00:00 GMT
Link: <https://developers.myleapp.fr/changelog/2027-03-01>; rel="deprecation"
TypeScript
import { Myle } from '@myleapp/myle';
// Called once per operation when the API serves it with an older behavior
// (a Node DeprecationWarning by default; null to stay silent).
const myle = new Myle({
apiVersion: '2026-12-01',
onDeprecation: (notice) => {
console.warn(`${notice.method} ${notice.path}: deprecated, sunset ${notice.sunset}, read ${notice.link}`);
},
});
await myle.me.get();
Python
from myle import DeprecationNotice, Myle
# Called once per operation when the API serves it with an older behavior
# (a MyleDeprecationWarning by default; None to stay silent).
def warn(notice: DeprecationNotice) -> None:
print(f"{notice.method} {notice.path}: deprecated, sunset {notice.sunset}, read {notice.link}")
myle = Myle(api_version="2026-12-01", on_deprecation=warn)
myle.me.get()
Go
package main
import (
"context"
"fmt"
"log"
myle "github.com/myleapp/myle-go"
)
func main() {
// Called once per operation when the API serves it with an older behavior
// (a line on the standard logger by default; nil to stay silent).
client := myle.NewClient(
myle.WithAPIVersion("2026-12-01"),
myle.WithDeprecationHandler(func(notice myle.DeprecationNotice) {
fmt.Printf("%s %s: deprecated, sunset %s, read %s\n", notice.Method, notice.Path, notice.Sunset, notice.Link)
}),
)
if _, err := client.Me.Get(context.Background()); err != nil {
log.Fatal(err)
}
}
Java
import fr.myleapp.myle.MyleClient;
public class Example {
public static void main(String[] args) {
// Called once per operation when the API serves it with an older behavior
// (a System.Logger warning by default; null to stay silent).
MyleClient client = MyleClient.builder()
.apiVersion("2026-12-01")
.onDeprecation(notice -> System.err.println(notice.method() + " " + notice.path()
+ ": deprecated, sunset " + notice.sunset() + ", read " + notice.link()))
.build();
client.me().get();
}
}
Scala
import fr.myleapp.myle.{DeprecationNotice, MyleClient, MyleConfig}
object VersioningDeprecation {
def main(args: Array[String]): Unit = {
// Called once per operation when the API serves it with an older behavior
// (a System.Logger warning by default; None to stay silent).
val warn = (notice: DeprecationNotice) =>
System.err.println(s"${notice.method} ${notice.path}: deprecated, sunset ${notice.sunset.getOrElse("")}, read ${notice.link.getOrElse("")}")
val myle = MyleClient(MyleConfig(apiVersion = "2026-12-01", onDeprecation = Some(warn)))
myle.me.get()
}
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
use Myle\Client;
use Myle\DeprecationNotice;
// Called once per operation when the API serves it with an older behavior
// (an E_USER_DEPRECATED by default; null to stay silent).
$myle = new Client(
apiVersion: '2026-12-01',
onDeprecation: function (DeprecationNotice $notice): void {
echo "{$notice->method} {$notice->path}: deprecated, sunset {$notice->sunset}, read {$notice->link}\n";
},
);
$myle->me->get();
C#
using Myle;
// Called once per operation when the API serves it with an older behavior
// (a line on the standard error by default; null to stay silent).
using var client = new MyleClient(new MyleClientOptions
{
ApiVersion = "2026-12-01",
OnDeprecation = notice =>
Console.Error.WriteLine($"{notice.Method} {notice.Path}: deprecated, sunset {notice.Sunset}, read {notice.Link}"),
});
await client.Me.GetAsync();
| En-tête | Sens |
|---|---|
Myle-API-Version | La date que vous avez demandée. |
Deprecation | Depuis quand ce comportement est remplacé (RFC 9745) : un temps Unix, ici minuit UTC le 1er mars 2027. |
Sunset | Quand il cessera d'être servi (RFC 8594), une fois la date fixée. |
Link; rel="deprecation" | La page du journal des changements : ce qui a changé et comment migrer. |
Le comportement le plus récent n'en porte aucun. Surveillez
Deprecation dans vos journaux : c'est le signal pour lire
le journal des changements.
Le journal des changements et le préavis de six mois
-
Chaque changement incompatible a sa page dans le
journal des changements, à l'adresse
developers.myleapp.fr/changelog/YYYY-MM-DD, la date du changement : ce qui change, quelles opérations, laMyle-API-Versionavant et après, les datesDeprecationetSunset, et les étapes de migration. -
La date
Sunsettombe au moins six mois après l'annonce du changement. D'ici là, l'ancien comportement continue de fonctionner pour chaque requête qui le demande. -
Après le retrait, l'ancien comportement disparaît : la date la plus
ancienne prise en charge par l'opération avance, et une
Myle-API-Versionplus ancienne répond400 core.api-version-unsupported.
Opérations publiées et internes
Seules les opérations du document OpenAPI, api.myleapp.fr/openapi.json, et de la référence sont publiées. Elles sont un contrat et suivent les règles ci-dessus. Une opération qui répond mais n'est pas dans le document est interne : sa forme peut encore changer sans préavis, ne construisez rien dessus. Le document décrit le comportement actuel de chaque opération.