Pregunta

What is maximum request size for Google Analytics API? I'm sending Analytics API request to google and getting back 414 Error, saying that request was too long.

Recently Added: I understand that http request link must be less than 2000 character, but rises another question. Is it possible to work with Google API using POST?

'metrics'=>'ga:pageviews,ga:uniquePageviews,ga:avgTimeOnPage,ga:entrances,ga:visitBounceRate,ga:exitRate,ga:pageValue',
    'dimensions' => 'ga:pagePath',
    'sort' => '-ga:pageviews',
    'filters' => $this->_filterLinks,
    'max-results' => '250');

_filterLinks is links from my db, for which i want to fetch updated statistics.

if $this->_filterLinks is less then 30 everything is OK if greater i'm getting 414 code in response.

There was an API error : 414 : Error calling GET https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A74527982&start-date=2014-05-01&end-date=2014-05-08&metrics=ga%3Apageviews%2Cga%3AuniquePageviews%2Cga%3AavgTimeOnPage%2Cga%3Aentrances%2Cga%3AvisitBounceRate%2Cga%3AexitRate%2Cga%3ApageValue&dimensions=ga%3ApagePath&sort=-ga%3Apageviews&filters=ga%3ApagePath%3D%3D%2F%2Cga%3ApagePath%3D%3D%2Fpflanzen-lexikon%2Cga%3ApagePath%3D%3D%2Fgarten-pflanzen.html%2Cga%3ApagePath%3D%3D%2Fratgeber.html%2Cga%3ApagePath%3D%3D%2Fwespen-vertreiben-so-geht-s.html%2Cga%3ApagePath%3D%3D%2Fbalkon-pflanzen.html%2Cga%3ApagePath%3D%3D%2Fratgeber%2Fpflanzengedichte.html%2Cga%3ApagePath%3D%3D%2Fpflanzen-lexikon%2Fentry%2Fgef%C3%A4%C3%9Fsporenpflanzen%2Cga%3ApagePath%3D%3D%2Fbalkonpflanzen-welche-passen-zusammen.html%2Cga%3ApagePath%3D%3D%2Fmagazin.html%2Cga%3ApagePath%3D%3D%2Fzimmer-pflanzen.html%2Cga%3ApagePath%3D%3D%2Fder-tulpenbaum-ein-neuer-gartentrend.html%2Cga%3ApagePath%3D%3D%2Fpflanzen-lexikon%2Fentry%2Findischer%2Bspinat%2Cga%3ApagePath%3D%3D%2Fbalkon-pflanzen%2Faffenbaum-die-aussergewohnlichkeit-in-person.html%2Cga%3ApagePath%3D%3D%2Fmagazin%2Fpflanzengeschichten%2Flena-s-tulpenbaum.html%2Cga%3ApagePath%3D%3D%2Fwespennest-darf-ich-es-selbst-entfernen.html%2Cga%3ApagePath%3D%3D%2Fwhere%2Fstandort%2Fsonne-bis-halbschatten%2Cga%3ApagePath%3D%3D%2Fzantedeschia.html%2Cga%3ApagePath%3D%3D%2Fbougainvillea-uberwintern-so-einfach-geht-s.html%2Cga%3ApagePath%3D%3D%2Fbrombeeren-schneiden-ist-wahrlich-keine-grosse-kunst.html%2Cga%3ApagePath%3D%3D%2Fcatalogsearch%2Fresult%2F%3Fq%3Dtulpenbaum%2Cga%3ApagePath%3D%3D%2Fcyperus-alternifolius-zyperngras.html%2Cga%3ApagePath%3D%3D%2Feine-feuerbohne-gegen-ein-feuriges-gemut.html%2Cga%3ApagePath%3D%3D%2Ffriedrich-ruckert-und-sein-gedicht-uber-das-erdbeerstrauchlein.html%2Cga%3ApagePath%3D%3D%2Flupinen-die-bluhenden-alleskonner.html%2Cga%3ApagePath%3D%3D%2Fmoos-im-rasen-so-wird-dein-rasen-wieder-gesund.html%2Cga%3ApagePath%3D%3D%2Fpflanzenschadlinge-im-garten-was-tun.html%2Cga%3ApagePath%3D%3D%2Fbaume-straucher%2Fpage%2F4.html%2Cga%3ApagePath%3D%3D%2Fcatalogsearch%2Fresult%2F%3Fq%3Dbuchsbaum%2Cga%3ApagePath%3D%3D%2Fpflanzenlust-blog.html%2Cga%3ApagePath%3D%3D%2Facorus-gramineus-zwergkalmus.html%2Cga%3ApagePath%3D%3D%2Fbaume-straucher%2Fkoniferen.html%2Cga%3ApagePath%3D%3D%2Fclematis-schneiden-1-pflanze-3-unterschiedliche-typen.html%2Cga%3ApagePath%3D%3D%2Fdatenschutz&max-results=250&key=AIzaSyDbutx9YEo6rgeqxqdLHcO7IEgEUD2Pvwg: (414) Error 414 (Request-URI Too Large)!!1 {margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}

414. That’s an error.

The requested URL /analytics/v3/data/ga... is too large to process. That’s all we know.

Am i Getting it from Google or from my local? If from my local there shouldn't be any google error message like That’s all we know. Am I doing right query? Is there any way to bypass this issue or limit? Thanks for your help!

¿Fue útil?

Solución

I don't think your getting a 414 from the Google API I think your either getting it from apache or the web browser.

Under Apache, the limit is a configurable value, LimitRequestLine. Change this value to something larger than its default of 8190 if you want to support a longer request URI.

Google Analytics API limits the number of dimensions and metrics you can send but there is no limit to how big your filter can be. (Assuming you are stringing them together using and and or a single filter value can be max 128 or you will get a 404 bad request error)

But assuming you keep tacking them on you will probably end up blowing out the limit set by apache. (Being that your not really sending the request though a web browser I wonder if you could set apache higher to handle the request. A web browser can max handle 2000 but this might not be an issue in this case because your not going though a web browser. But that will depend on if Google will even except a request that long.) I will have to test this.

Edit Post: No The request to get data back form the API is a Get not a Post. Post would be sending information to the server not Requesting the server to give you information back.

Otros consejos

The max request size is 10,000. But the response will tell you how many records are present and you can loop and request additional pages with "start-index" parameter. So with four calls you can request the 40,000 entries. But be sure to catch HTTP quota errors and delay your calls if you exceeded the requests per second quota.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top