(En cours de redaction)

RosaLog API

API REST d'interrogation et manipulation des données

Introduction à l'utilisation de l'API REST de RosaLog

Chaque appel à l'API doit fournir les entêtes HTTP suivant :

  • X-ORGANIZATION : Il s'agit du compte entreprise, c'est à dire du nom de la base de données (par exemple, palatino ou palatino-test)
  • X-API-KEY : Il s'agit d'une clé secrète, affectée à un utilisateur. Les droits de l'API seront ceux de l'utilisateur concerné.
  • X-MODEL : (Optionel) : Il s'agit du nom du modèle de données à utiliser, soit le générique EntrepriseModel, soit un spécifique, par exemple PalatinoModel
Retour de l'appel

Le service renvoie les codes HTTP suivants :

  • 200 : Tout s'est bien passé
  • 401 : La clé X-API-KEY passée est invalide (ou le compte inexistant)
  • 500 : Une erreur s'est produite, le corps du message peut contenir une explication

Exemple : Lecture de tous les types d'intervention

curl -X GET --location "https://VOTRESERVEUR.rosalog.com/up/storage/WorkType.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE"

Exemple : Création d'une visite

curl -X POST --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '[{"name" : "NOUV"}]'

Exemple : Création de plusieurs visites

curl -X POST --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '[{"name" : "NOUV A1"}, {"name" : "NOUV A2"}, {"name" : "NOUV A3"}]'

Exemple : Modification d'une visite

curl -X PUT --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId" : "651c0db7fc192502ef700d0f", "name" : "YO"}'

Exemple : Ajout de commentaires à une visite

curl -X PATCH --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId":"651c0db7fc192502ef700d0f", "comments":[{"comment": "Comm"}]}'

Exemples d'utilisation de l'API REST dans le cadre de la planification de visites

Exemple : Ajout d'un intervenant à une visite

curl -X PATCH --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId":"651c0db7fc192502ef700d0f", "assignments":[{"resource_ref": "651c074dfaadd111b91822e1"}]}'

Exemple : Désaffectation d'une visite

curl -X PUT --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId":"651c0db7fc192502ef700d0f", "assignments":null}'

Exemple : Déplanification d'une visite

curl -X PUT --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId":"651c0db7fc192502ef700d0f", "intervals":null}'

Exemple : Déprogrammation d'une visite

WORK_DATA_ID=123456789
curl -X PUT --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '{"dataId":"'$WORK_DATA_ID'", "intervals":null, "assignments":null}'

Exemple : Création d'une visite pour un client

CUSTOMER_DATA_ID=123456789
curl -X POST --location "https://VOTRESERVEUR.rosalog.com/up/storage/Work.json" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8" \n-d '[{"name" : "Pour mon client", "customer":'$CUSTOMER_DATA_ID'}]'

Consultation de Planning

curl -X GET --location "https://VOTRESERVEUR.rosalog.com/up/planning/planningService/programmedWorks/2024-06-19/2024-06-25/" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8"
curl -X GET --location "https://VOTRESERVEUR.rosalog.com/up/planning/planningService/programmedWorks/2024-06-19/2024-06-25/665d708d4c27574b85df9382,665d708d4c27574b85df937e" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8"
curl -X GET --location "https://VOTRESERVEUR.rosalog.com/up/planning/planningService/worksToProgram/2024-06-19/2024-06-25/" \n-H "X-ORGANIZATION: VOTREENTREPRISE" \n-H "X-API-KEY: VOTRECLE" \n-H "Content-Type:text/plain;charset=UTF-8"