> For the complete documentation index, see [llms.txt](https://ouvretaferme.gitbook.io/ouvretaferme/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ouvretaferme.gitbook.io/ouvretaferme/endpoints/general/structure/systeme-de-production.md).

# Système de production

Le système de production de votre structure : lieu, surface, sol, main d'œuvre et répartition des circuits de vente. Une seule fiche par structure.

## Consulter le système de production

> Scope requis : \`general:read\`.

```json
{"openapi":"3.0.3","info":{"title":"API Ouvretaferme","version":"0.1beta"},"tags":[{"name":"Système de production"}],"servers":[{"url":"https://api.ouvretaferme.org/0.1beta"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Clé API personnelle ou jeton OAuth2 d'une application tierce, présenté dans l'en-tête `Authorization: Bearer`. Voir la section Authentification."}},"responses":{"ValidationError":{"description":"Un champ, un filtre ou un argument ne respecte pas les règles de validation, ou le corps n'est pas un objet JSON.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"AuthenticationError":{"description":"Clé API ou jeton absent, invalide, expiré ou révoqué.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"Forbidden":{"description":"Le jeton ne porte pas le scope requis, l'écriture n'est pas ouverte à cette structure, la structure n'a pas l'abonnement qui ouvre l'API, ou la personne qui a créé la clé n'administre plus la structure.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"NotFound":{"description":"Aucun élément avec cet identifiant pour votre structure.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"RateLimited":{"description":"Trop d'appels. L'en-tête `Retry-After` donne le nombre de secondes à attendre.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"headers":{"Retry-After":{"description":"Nombre de secondes à attendre avant le prochain appel.","schema":{"type":"integer"}}}}},"schemas":{"Error":{"type":"object","properties":{"type":{"type":"string","enum":["authentication_error","resource_error","api_error"]},"code":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/system":{"get":{"operationId":"getSystem","tags":["Système de production"],"summary":"Consulter le système de production","description":"Scope requis : `general:read`.","parameters":[],"responses":{"200":{"description":"Réponse propre à cette route.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/AuthenticationError"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"412":{"description":"Condition métier interdisant cette action.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"429":{"$ref":"#/components/responses/RateLimited"}}}}}}
```

## Modifier un système de production

> Scope requis : \`general:write\`. Le corps porte tous les champs modifiables, ou seulement ceux que nomme sa clé \`properties\` (mise à jour partielle, voir la vue d'ensemble). En partiel, doivent être envoyées ensemble : \`sellingDirect\` + \`sellingSemi\` + \`sellingLong\` ; \`place\` + \`placeLngLat\`.

```json
{"openapi":"3.0.3","info":{"title":"API Ouvretaferme","version":"0.1beta"},"tags":[{"name":"Système de production"}],"servers":[{"url":"https://api.ouvretaferme.org/0.1beta"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Clé API personnelle ou jeton OAuth2 d'une application tierce, présenté dans l'en-tête `Authorization: Bearer`. Voir la section Authentification."}},"schemas":{"SystemWrite":{"type":"object","properties":{"place":{"type":"string","minLength":1,"nullable":true,"description":"Lieu de production."},"placeLngLat":{"type":"string","nullable":true},"totalArea":{"type":"number","nullable":true,"description":"Surface agricole utile (SAU)."},"altitude":{"type":"integer","nullable":true,"description":"Altitude de la production."},"soil":{"type":"string","enum":["sableux","limoneux","argileux","sablo-limoneux","limono-sableux","sablo-argileux","sablo-argilo-limoneux","argilo-sableux","limono-argileux","limono-argilo-sableux","argilo-limoneux"],"nullable":true,"description":"Texture du sol. Valeurs : `sableux` (Sable), `limoneux` (Limon), `argileux` (Argile), `sablo-limoneux` (Sable limoneux), `limono-sableux` (Limon sableux), `sablo-argileux` (Sable argileux), `sablo-argilo-limoneux` (Sable argilo-limoneux), `argilo-sableux` (Argile sableuse), `limono-argileux` (Limon argileux), `limono-argilo-sableux` (Limon argilo-sableux), `argilo-limoneux` (Argile limoneuse)."},"ph":{"type":"number","nullable":true,"description":"pH."},"hrFarmer":{"type":"number","nullable":true,"description":"Exploitant."},"hrEmployee":{"type":"number","nullable":true,"description":"Salarié."},"hrOther":{"type":"number","nullable":true,"description":"Stagiaire / Bénévole."},"sellingDirect":{"type":"integer","nullable":true,"description":"Vente directe."},"sellingSemi":{"type":"integer","nullable":true,"description":"Vente demi-gros."},"sellingLong":{"type":"integer","nullable":true,"description":"Circuits longs."}},"required":["place","placeLngLat","totalArea","altitude","soil","ph","hrFarmer","hrEmployee","hrOther","sellingDirect","sellingSemi","sellingLong"]},"System":{"type":"object","properties":{"id":{"type":"integer","format":"int64","readOnly":true},"place":{"type":"string","minLength":1,"nullable":true,"description":"Lieu de production."},"placeLngLat":{"type":"string","nullable":true},"totalArea":{"type":"number","nullable":true,"description":"Surface agricole utile (SAU)."},"altitude":{"type":"integer","nullable":true,"description":"Altitude de la production."},"soil":{"type":"string","enum":["sableux","limoneux","argileux","sablo-limoneux","limono-sableux","sablo-argileux","sablo-argilo-limoneux","argilo-sableux","limono-argileux","limono-argilo-sableux","argilo-limoneux"],"nullable":true,"description":"Texture du sol. Valeurs : `sableux` (Sable), `limoneux` (Limon), `argileux` (Argile), `sablo-limoneux` (Sable limoneux), `limono-sableux` (Limon sableux), `sablo-argileux` (Sable argileux), `sablo-argilo-limoneux` (Sable argilo-limoneux), `argilo-sableux` (Argile sableuse), `limono-argileux` (Limon argileux), `limono-argilo-sableux` (Limon argilo-sableux), `argilo-limoneux` (Argile limoneuse)."},"ph":{"type":"number","nullable":true,"description":"pH."},"hrFarmer":{"type":"number","nullable":true,"description":"Exploitant."},"hrEmployee":{"type":"number","nullable":true,"description":"Salarié."},"hrOther":{"type":"number","nullable":true,"description":"Stagiaire / Bénévole."},"sellingDirect":{"type":"integer","nullable":true,"description":"Vente directe."},"sellingSemi":{"type":"integer","nullable":true,"description":"Vente demi-gros."},"sellingLong":{"type":"integer","nullable":true,"description":"Circuits longs."}},"title":"Système de production","description":"Le système de production de votre structure : lieu, surface, sol, main d'œuvre et répartition des circuits de vente. Une seule fiche par structure."},"Error":{"type":"object","properties":{"type":{"type":"string","enum":["authentication_error","resource_error","api_error"]},"code":{"type":"string"},"message":{"type":"string"}}}},"responses":{"ValidationError":{"description":"Un champ, un filtre ou un argument ne respecte pas les règles de validation, ou le corps n'est pas un objet JSON.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"AuthenticationError":{"description":"Clé API ou jeton absent, invalide, expiré ou révoqué.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"Forbidden":{"description":"Le jeton ne porte pas le scope requis, l'écriture n'est pas ouverte à cette structure, la structure n'a pas l'abonnement qui ouvre l'API, ou la personne qui a créé la clé n'administre plus la structure.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"NotFound":{"description":"Aucun élément avec cet identifiant pour votre structure.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}}},"RateLimited":{"description":"Trop d'appels. L'en-tête `Retry-After` donne le nombre de secondes à attendre.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Error"}}}},"headers":{"Retry-After":{"description":"Nombre de secondes à attendre avant le prochain appel.","schema":{"type":"integer"}}}}}},"paths":{"/system":{"put":{"operationId":"putSystem","tags":["Système de production"],"summary":"Modifier un système de production","description":"Scope requis : `general:write`. Le corps porte tous les champs modifiables, ou seulement ceux que nomme sa clé `properties` (mise à jour partielle, voir la vue d'ensemble). En partiel, doivent être envoyées ensemble : `sellingDirect` + `sellingSemi` + `sellingLong` ; `place` + `placeLngLat`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/SystemWrite"},{"type":"object","title":"Mise à jour partielle","description":"Les champs nommés dans `properties`, et eux seuls, chacun à sa nouvelle valeur.","required":["properties"],"properties":{"properties":{"type":"array","minItems":1,"items":{"type":"string","enum":["place","placeLngLat","totalArea","altitude","soil","ph","sellingDirect","sellingSemi","sellingLong","hrFarmer","hrEmployee","hrOther"]}}},"additionalProperties":true}]}}}},"responses":{"200":{"description":"Système de production modifié.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/System"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/AuthenticationError"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}}}}
```
