← retour aux snippets

HTTPie: tester des APIs proprement

Envoyer des requêtes HTTP lisibles avec JSON, auth et TLS faciles.

bash network #httpie#http#api

objectif

Remplacer curl pour des tests interactifs lisibles.

code minimal

http GET https://api.data.pm/v1/status

utilisation

# POST JSON et auth
http POST https://api.data.pm/v1/items name=foo enabled:=true Authorization:"Bearer $TOKEN"

variante(s) utile(s)

# télécharger un fichier
http --download https://data.pm/file.bin

notes

  • := pour types JSON; = pour chaînes.
  • respecte les variables http_proxy/https_proxy.