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 :

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.

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();

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êteSens
Myle-API-VersionLa date que vous avez demandée.
DeprecationDepuis quand ce comportement est remplacé (RFC 9745) : un temps Unix, ici minuit UTC le 1er mars 2027.
SunsetQuand 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

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.