Pré-requis :
Accès à l'API (compte Greenspector)
Token privé (sur https://core-saas-prod.greenspector.com/, cliquez sur votre nom d'utilisateur puis sur Préférences)
URL du site web à comparer
Swagger de l’API : https://core-saas-prod.greenspector.com/api/ui/#
Créer une application
URL cible : https://core-saas-prod.greenspector.com/
URI : /api/applications
Méthode : POST
En-têtes :
Content-Type : « application/json »
Token privé : jeton privé de l'utilisateur
Corps:
{ "name":"My App", "description":"Description" }
Créer une requête job
URL cible : https://core-saas-prod.greenspector.com/
URI : /api/testbench/jobs
Méthode : POST
En-têtes :
Content-Type : « application/json »
Token privé : jeton privé de l'utilisateur
Corps:
{ "application": "My app", "version": "My version (string)", "job": { "mode": "url", "url": "https://greenspector.com/fr/accueil/", "scenario": "avance", "iterations": 1, "cache": false, "browser": "chrome", "networkMode": "WIFI" }, "environment": { "platform": "mobile", "os": "android", "version": "8", "device": "Samsung - Galaxy S7" } }
Exemple :
{ "application": "My app", "version": "1.0.0", "job": { "mode": "url", "url": "https://greenspector.com/fr/accueil/", "scenario": "avance", "iterations": 1, "cache": false, "browser": "chrome", "networkMode": "WIFI" }, "environment": { "platform": "mobile", "os": "android", "version": "8", "device": "Samsung - Galaxy S7" } }
Réponse :
{ "applicationId": 1, "auditId": 2, "jobId": 3 }
Superviser l'état du job
URL cible : https://app.greenspector.com
URI : /api/testbench/jobs/:jobId
Méthode : GET
En-têtes :
Token privé : jeton privé de l'utilisateur
Réponse :
{ "id": :jobId, "status": "finished", "errors": [], "startDate": "2021-01-18T10:01:17.000Z", "endDate": "2021-01-18T10:04:25.000Z", "mode": "url", "browser": "chrome", "url": "", "TestsStatus": [ [ { "Dumpsys": false, "IterationID": "1", "Logs": "", "StackTrace": "", "Status": "success", "TestGroupName": "", "TestName": "Benchmark URL" } ] ], "TestBenchEnvironment": { "platform": "mobile", "os": "android", "version": "8", "device": "Samsung - Galaxy S7" } }
Retrieve the job’s report :
URL cible : https://core-saas-prod.greenspector.com/
URI : /api/audits/:auditId/report
Méthode : GET
En-têtes :
Token privé : jeton privé de l'utilisateur
Réponse :
{ "application": { "name": "My app", "id": 1 }, "audit": { "version": "1.0.0", "id": 2 }, "summary": { "ecoscore": { "global": 57, "network": 75, "clientresources": 39 }, "budgets": { "notConfigured": 4, "total": 4 }, "tests": { "total": 1, "failed": 0 }, "improvements": { "critical": 5, "major": 3, "good": 5 } }, "improvements": [ { "name": "Minimize impact on platform discharge on mobile during background idle step", "priority": 4, "score": 11.11, "gain": 0 } ], "benchmark": { "pc": [], "mobile": [ { "name": "reference_mobile_apk", "order": 1, "networkMode": "WIFI", "metrics": { "AH_PL": { "value": 960464 }, "AH_PL/s": { "value": 49303.9 }, "C_ID": { "value": 0 }, "C_PL": { "value": 13.5627 }, "D_ID": { "value": 0 }, "D_IN_ID": { "value": 0 }, "D_OUT_ID": { "value": 0 }, "M_ID": { "value": 0 }, "M_PL": { "value": 1456320 }, "MAX_O_DPacket_ID": { "value": 0 }, "PMAX_PL": { "value": 1700.64 }, "TOTAL_O_DPacket_ID": { "value": 0 }, "TT_PL": { "value": 20132 }, "O_Activities": { "value": 0 }, "O_AppContexts": { "value": 0 }, "O_AssetManagers": { "value": 0 }, "O_Assets": { "value": 0 }, "O_Death_Recipients": { "value": 0 }, "O_OpenSSL_Sockets": { "value": 0 }, "O_ViewRootImpl": { "value": 0 }, "O_Views": { "value": 0 }, "SQL_MALLOC_SIZE": { "value": 0 }, "SQL_MEMORY_USED": { "value": 0 }, "SQL_PAGECACHE_OVERFLOW": { "value": 0 } } }, { "name": "initial_load_mobile_url", "order": 2, "networkMode": "WIFI", "metrics": {...} }, { "name": "initial_idle_mobile_url", "order": 3, "networkMode": "WIFI", "metrics": {...} }, { "name": "initial_scroll_mobile_url", "order": 4, "networkMode": "WIFI", "metrics": {...} }, { "name": "initial_background_mobile_url", "order": 5, "networkMode": "WIFI", "metrics": {...} } ], "apk": [] }, "tests": [] }