Commit 66d82a125807f6adc7d8c3bd72b38f67a5736396

Authored by Alex Savenko
1 parent d6129203

doc metrics

Showing 1 changed file with 62 additions and 1 deletions   Show diff stats
app/library/App/Resources/GaResource.php
... ... @@ -28,9 +28,70 @@ class GaResource extends ApiResource {
28 28 ->deny(AclRoles::UNAUTHORIZED)
29 29 ->handler(GaController::class)
30 30  
31   - ->endpoint(ApiEndpoint::get('{metric}', 'getAction')
  31 + ->endpoint(ApiEndpoint::get('?{metric}', 'getAction')
32 32 ->allow(AclRoles::USER)
33 33 ->description('Returns data from Google Analytics Api')
  34 + ->exampleResponse('
  35 + {
  36 + "reports": [
  37 + {
  38 + "columnHeader": {
  39 + "metricHeader": {
  40 + "metricHeaderEntries": [
  41 + {
  42 + "name": "users",
  43 + "type": "INTEGER"
  44 + },
  45 + {
  46 + "name": "sessionsPerUser",
  47 + "type": "FLOAT"
  48 + }
  49 + ]
  50 + }
  51 + },
  52 + "data": {
  53 + "rows": [
  54 + {
  55 + "metrics": [
  56 + {
  57 + "values": [
  58 + "4814",
  59 + "1.23764021603656"
  60 + ]
  61 + }
  62 + ]
  63 + }
  64 + ],
  65 + "totals": [
  66 + {
  67 + "values": [
  68 + "4814",
  69 + "1.23764021603656"
  70 + ]
  71 + }
  72 + ],
  73 + "rowCount": 1,
  74 + "minimums": [
  75 + {
  76 + "values": [
  77 + "4814",
  78 + "1.23764021603656"
  79 + ]
  80 + }
  81 + ],
  82 + "maximums": [
  83 + {
  84 + "values": [
  85 + "4814",
  86 + "1.23764021603656"
  87 + ]
  88 + }
  89 + ]
  90 + }
  91 + }
  92 + ]
  93 + }
  94 + ')
34 95 )
35 96 ;
36 97  
... ...