Importez des lignes CSV ou de tableur JSON sous forme de documents brouillon, un par ligne.
Importez les lignes CSV (ou les lignes d'un tableur JSON) sous forme de documents brouillon, un document par ligne.
Auth. : JWT Bearer (WorkOS).
| ParamĂštre | Type | Obligatoire | Remarques |
|---|---|---|---|
website_id | uuid | oui | Site web cible. Remarque : snake_case ici, contrairement Ă la plupart des points de terminaison. |
Deux types de contenu sont acceptĂ©s, dĂ©terminĂ©s par l'en-tĂȘte Content-Type.
multipart/form-data â champs :
schema_name (texte, obligatoire)file (octets CSV bruts, obligatoire). La premiĂšre ligne correspond aux en-tĂȘtes ; chaque cellule devient une valeur de chaĂźne JSON nettoyĂ©e.application/json (10 Mio max) :
{
"schema_name": "publication",
"spreadsheet_data": [ { "title": "Ligne 1" }, { "title": "Ligne 2" } ]
}
schema_name (chaßne, obligatoire)spreadsheet_data (tableau d'objets, obligatoire){ "insérés": 2 }
Renvoie 201 Created. Chaque ligne devient un document brouillon ; le titre du document correspond Ă la premiĂšre valeur de chaĂźne de la ligne.
curl -X POST '{CMS_API_URL}/csv?website_id=<uuid>' \
-H 'Authorization: Bearer <workos-jwt>' \
-H 'Content-Type: application/json' \
-d '{"schema_name":"publication","spreadsheet_data":[{"title":"Ligne 1"}]}'
curl -X POST '{CMS_API_URL}/csv?website_id=<uuid>' \
-H 'Authorization: Bearer <workos-jwt>' \
-F 'schema_name=publication' \
-F 'file=@donnees.csv'
400 â erreurs d'analyse, schema_name/file manquants, spreadsheet_data non tableau, lignes non objets ou CSV vide401 â JWT manquant ou invalide500 â Ă©chec de l'insertion