Modification d’une ressource

Paramètres HTTP

Paramètre

Valeur

Route

ressource

Méthode

PUT

Contenu

ressource au format json

Contenu de la requête HTTP

La requête contiendra le scénario avec la ressource à modifier.

Pour l’objet scénario, les propriétés CdScenario et Ressources sont obligatoires.

Pour l’objet ressource, la propriété CdRessource est obligatoire.

Pour les objets entitehydro, un des deux attributs est obligatoire: CdSiteHydro ou CdStationHydro.

Schéma de validation

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://bdprev.org/modifyressource.json",
  "type": "object",
  "properties": {
    "CdScenario": {
      "type": "string"
    },
    "Ressources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "CdRessource": {
            "type": "integer"
          },
          "Grandeur": {
            "type": "string"
          },
          "Type": {
            "type": "integer"
          },
          "Nature": {
            "type": "integer"
          },
          "EntitesHydro": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "CdSiteHydro": {"type":  "string"},
                "CdStationHydro": {"type":  "string"}
              },
              "oneOf": [
                {"required": ["CdStationHydro"]},
                {"required": ["CdSiteHydro"]}
              ],
              "additionalProperties": false
            },
            "minItems": 1
          },
          "SitesMeteo": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "CdSiteMeteo": {"type":  "string"}
              },
              "required": ["CdSiteMeteo"],
              "additionalProperties": false
            },
            "minItems": 1
          },
          "BassinsVersants": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "CdBNBV": {"type":  "string"}
              },
              "required": ["CdBNBV"],
              "additionalProperties": false
            },
            "minItems": 1
          },
          "Series": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "CdSerie": {"type":  "string"}
              },
              "required": ["CdSerie"],
              "additionalProperties": false
            },
            "minItems": 1
          }
        },
        "required": [
          "CdRessource"
        ],
        "additionalProperties": false

      },
      "minItems": 1,
      "maxItems": 1
    }
  },
  "required": ["CdScenario", "Ressources"],
  "additionalProperties": false
}

Exemple d’entrée

{
  "CdScenario": "CDSCENARIO",
  "Ressources": [
    {
      "CdRessource": 1,
      "Grandeur": "RR",
      "Type": 2,
      "Nature": 1,
      "EntitesHydro": [
        {
          "CdSiteHydro": "A1234567"
        },
        {
          "CdStationHydro": "A123456789"
        }
      ]
      "SitesMeteo": [
        {
          "CdSiteMeteo": "012345678"
        }
      ]
      "BassinsVersants": [
        {
          "CdBNBV": "CDBNBV"
        }
      ]
      "Series": [
        {
          "CdSerie": "moy"
        }
      ]
    }
  ]
}

Droit de gestion

L’utilisateur du web-service doit être authentifié et disposer du profil gestionnaire de modèles.

Sortie du web-service

Le web-service renverra la ressource modifiée.

Au scénario d’entrée, le web-service rajoutera les attributs:

  • les libellés des entités hydro et des sites météo (LbSiteHydro, LbStationHydro, LbSiteMeteo);

  • DtMaj: date de mise à jour de la ressource.

Exemple de sortie

{
  "CdScenario": "CDSCENARIO",
  "Ressources": [
    {
      "CdRessource": 1,
      "Grandeur": "RR",
      "Type": 2,
      "Nature": 1,
      "EntitesHydro": [
        {
          "CdSiteHydro": "A1234567",
          "LbSiteHydro": "Libellé du site hydro"
        },
        {
          "CdStationHydro": "A123456789",
          "LbStationHydro": "LIbellé de la station hydro"
        }
      ]
      "SitesMeteo": [
        {
          "CdSiteMeteo": "012345678",
          "LbSiteMeteo": "Libellé du site météo"
        }
      ]
      "BassinsVersants": [
        {
          "CdBNBV": "CDBNBV"
        }
      ]
      "Series": [
        {
          "CdSerie": "moy"
        }
      ],
      "DtMaj": "2024-07-10T09:00:00"
    }
  ]
}