Skip to content
This repository has been archived by the owner on Mar 1, 2021. It is now read-only.

Calling the elevation API with a POST request #65

Open
0nko opened this issue Feb 21, 2016 · 4 comments
Open

Calling the elevation API with a POST request #65

0nko opened this issue Feb 21, 2016 · 4 comments
Assignees
Labels

Comments

@0nko
Copy link

0nko commented Feb 21, 2016

Hi,
when calling the elevation API I noticed that for some of the longer path requests I started getting "Failed to parse json request" error. The json query parameter was probably too long and got cut off. So I tried sending the JSON in a POST HTTP body instead and it worked. I think mentioning this in the docs could be useful.
Ondrej

@0nko 0nko changed the title Sending data with a POST request Calling the elevation API with a POST request Feb 21, 2016
@kevinkreiser
Copy link
Member

If the request is too large you'll get back an http 413 from this code:

https://github.com/kevinkreiser/prime_server/blob/master/src/http_protocol.cpp#L404

Most importantly though this size limit applies to both POST and GET (and any other type of request). So the limits do not differ.

"Failed to parse json request" is a message that skadi sends back when it cant make sense of the json string. So either you hit the browser limit and it cut your json off, sending only partial json to skadi or there really was a problem with the json. the only other possibility is that boost::property_tree is choaking on really large json but i've not seen problems with that yet other than it taking up lots of memory and a long time to parse

@kevinkreiser
Copy link
Member

also, can you get us a request that produces this behavior so we can investigate what is going on?

@0nko
Copy link
Author

0nko commented Feb 21, 2016

You're right, the browser was cutting the json off when I was inspecting the problem. But the actual request is failing on 502: BAD GATEWAY error.

The original request:

https://elevation.mapzen.com/height?id=Cross&api_key=elevation-xxxxx&json=%7B%22encoded_polyline%22%3A%22elao%7EAcknnZe%40wMumApOvChk%40d%40nHsZjEeALuDh%40WqFM%7DAyGy_BWmFm%40iNaRifEUeEz%40gFpBoE%7ENj%40rFJh%5C%5CmBxL%7DAjGaBjFuFru%40sI%60Hu%40bxAuPU_HqB%7Df%40OwEMoEyBow%40OoG%3FiDl%40wa%40F_F%60BsBrFkFpB%60Ebk%40l%5DtOmBvIg%40%60BKbG%5DrLc%40%7CD%40m%40qIGkCcAqX%5D%7DTLsP%7C%40%7BUzEqh%40%7CEsYpGaXdP_e%40jVu%60%40w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BmEk%60%40%7BK_y%40%7D%40wGiBoSkBmKaGyIm_%40ua%40kGmEag%40cQwv%40i%5Bku%40cVdEuv%40vIgaBlc%40iAiLct%40%5D%7DDeAcKaCuLiBeOiH%7Dx%40qBsTiByJcGoMaCk%40sA%7DAmE_CaCuBcKqZoSyl%40_d%40%7D%7CAkF_QiRy%60%40cKiRoIyXiCgPcA%7BKsAei%40m%40eDyHq%60%40%7DXauAmKi%60%40wMy%60%40w%7C%40e%7DB%7Di%40c%7BAaBqDs%60%40xe%40e%7E%40meC_i%40ouAiu%40ihBg%5ErXmZ%7B%7C%40e_%40kbAwb%40s%7E%40_Sy_%40aCaH%7BU%7EFsVrI%7DJvGaHtBob%40oF%7BQdAmDyC_JoHcF_PsFcTiC_Q%7BAiTMoBm%40JmUbDoNb%40yGDsABeEFgDDeOOqXWeJqGqQoNoNsPkLeQyWoo%40mTiZ%7DTgWmU%7BRq_Agn%40k%60A_r%40qhB%7DdBw%7CAyyAsdAy%7D%40qeAs%7D%40yf%40mm%40q%5C%5Cmf%40aR%7DYofAyzAoSw%5DwN%7D%5DgNak%40uOuo%40qv%40ucEei%40yyB_%5E_%7CAam%40%7BnBeh%40gpB%3F_LsBgLyQup%40uYm%60A_JuVwMmTuPaSgaAqw%40eOuP%7DOuVku%40gzAwIiVgIyUsPq%7D%40q%60AcjFmPibA%7DYqxAgIsY_DwK%7BU_e%40c%5Bs%5EifAacAqa%40wb%40sy%40s%7D%40c%5Bqd%40%7B%5Bue%40o%5Eq%5E%7B_%40k%5C%5Cy%5C%5Cs%5Buc%40a%5E_m%40ii%40yMsHiMyBu%40k%40mErC%7DDxCkQj%40oIf%5DgHpUuE%7DDuy%40e_%40gHuCoc%40eSkAnAcAtCmAnZ_C%60f%40oD%7Ee%40GnQ%7DD%7CQyMr%7B%40%7B%40%60RmEfQkf%40ncBsKzPc%60%40%7Cw%40k%60%40zn%40qg%40zp%40qBnGOrG%7B%40nAkB%7EBs%40x%40sAa%40%7D%40c%40oN%60LsU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7BAni%40m%7DAn%7B%40%7DyDvi%40mqFpp%40krGlt%40%7BZ%60CqH%60Vc%5Btg%40cQ%7DpAun%40wtEifAg_I%7Em%40mfK%7BlC%7BXkeD%60I%7BQp%40mx%40n%40_jCcy%40qjA%7DLqiGieA%7D%7BBwd%40qeAs%60%40yMeDcKx%40%7Bk%40dc%40st%40dVsZnQoNf%40%7Dd%40iL%7B%60%40uMy%5BmWsPkQgOgLmO_GiGuEoIaQk%60%40eh%40a%5DwH%7BAoIjAcRfJ_a%40d_%40cs%40d_%40g%7B%40bwBqoEvb%40yfAxa%40ibBpHsc%40lEqWt%40sXl%40wHtOwo%40%7CNiv%40dFiKtOoTvHsLlO_Yuh%40id%40i%7B%40gn%40gc%40eo%40%7D%7E%40gr%40oSgXcViQsZeOwNcKsPsOmPwVqGaOqRwl%40sV%7D%7C%40ajAs%7EBun%40gvAqnBk%7DBwlAyuAgkBweCig%40w%7C%40shAidCmrA%7D%7CDqg%40c%7CAayBgkFyGoHknFcjCmaCkw%40cLoH%7DgA%7BkAwoBoeAesAuc%40%7DrAiYaWkQ%7D%5Ecb%40_JcMmIsLc%5C%5C%7BVa%5C%5CwQ%7BKwHeU%60AyBvAce%40bKq%5C%5CbFwDhEcBxFs%40bQ%7D%40pt%40qBnNqLho%40wYdnAwWtnAmKpb%40eE%7EHe%40bAcV%60e%40uyH%60uFck%40zXyGVmKaKqjE_uEaS%7BNaMaCaRiJa_Beq%40sa%40%7D%5C%5Cke%40sVmn%40%7Dc%40iGmEyB%7DJme%40meAaa%40o%60AgSyb%40eFkGyGoGgh%40eOqLwHmOiMmE_MyBsmAyCcd%40oI%7B%60%40%7D%60BywF%7Bz%40ccCsu%40kmEeJ%7DjBqB_YaCkLiHu%60%40aLy%5D%7D_%40%7BgAqWgjAcLkn%40yV%7DwBgwA%7BnGqiB_pEyQ%7Di%40y%5C%5CseAiGsKom%40ws%40mO%7DIeiAy%60%40qGqDgOoNkKgOyBgFiBkGsLk%7C%40dEs%5BjQwv%40rFyS%7Dc%40in%40ePsYeUgk%40sAoGcAqG%5DmNGoSvDe%7BAxBui%40%60R%7BfCzEyqDiGqdAgXwdAguBsjEeUes%40cWyeBmn%40ksBuwAqrD%7By%40whCe%7DAikAsy%40yUimDymBiu%40g%5B%7BAoOiHce%40_Ied%40yHu%60%40cFqIwIoNaR_QgNw%40uOJcGo%40gSyG_O_Haf%40g%5BeUqJom%40wXePeJec%40ub%40k%5C%5C%7B%5B_b%40ma%40%7BVqVy%7B%40odAuw%40cl%40%7BxBqqAwWaZsk%40gx%40wg%40mx%40iHkMklCoaDeUatAcwBaxG%7DrAarCkj%40%7D%7B%40al%40gy%40_qBa%7EBcnBuoDsuDyrLkt%40_yEwI%7Bj%40se%40iyAouAcaCeZ_y%40ucAmvJuD_z%40uE_lAiC_OgSqKuTsFiw%40%7DLaBUiWqVaNqBaM%60HwH%7EK_InAqHs%40uTcKkk%40%7D%5ByA%7BD%7BG%5C%5Ce%5Eol%40%7Dd%40yiA%7B%40_A%7BAgEWoB%5DsIcAuj%40uO%7Da%40gOmC_%5DdP%7Bu%40uAoC%7Bk%40z%60%40%7Dg%40dEkJpQor%40%7ENaq%40%7CYevBjK%7B%7B%40%60I%7Bz%40jA%7BFlEmPnCkN%7EDyZdE_n%40l%40qR%60CiPlDoPzFoHjKmG%7COc%40EaTm%40uScBwY%7DD_g%40qCwSoDeToHq%5C%5CmJi%5B%7BPwa%40sVwb%40s%60%40me%40ig%40uh%40kd%40ag%40cVk%5C%5CsLf%40wNyFyLcSsK_XcLwOkLcHyjAeVu%7D%40wTy%7DB_dAqtBwg%40qq%40%60K_vFpj%40ko%40n%5C%5Cmi%40jGsu%40dA%7DlAuReoDk%60AqjBag%40atAaMmlByMgn%40wSoCqAcBgAyB%7DDkAuBcA_B%7BAy%40sF%7B%40%7DDsAyRkHkGyD_m%40%7D%60%40ksAa%5D_i%40af%40gNiS_IoJeZoe%40qLgXqCmKkFif%40T%7Bb%40vIaeAcAcLwDkEqBoF%5C%5C%7Dt%40%7BE%7Bc%40_YgqAsGce%40_HuiAoJ_l%40oMmm%40eFgQ%7BU%7Dv%40oNsf%40y%5C%5CkpB%7DSkhAwTmkAm%5EakBeFij%40yFaJgDqFuT%7D%5EsB%7CCmE%7EGeOhPsQlG%7BKz%40mTcE%7Bo%40oPuTs%40%7Bt%40kW_%5EcEab%40qHaM%7BC%7DJiCcQwFuIi%40oIe%40wDoB%7DICcQ%3FwIImOs%40oNgAs%60%40pAoDEcj%40kCeUIiMD_%5DtC%7Dy%40rIqa%40%60AmTgBmd%40%7EFyLlAuYvE%7DECwCB_Et%40tJqn%40nNedBhMknA%60C%7Dn%40%5C%5CaX_Dc%5Bm%40iGGgJvDuP_IqCkAa%40kBq%40q_Bej%40%7BAe%40sAi%40k%40%60DGX%3F%5C%5C%60HrjBFn%40%3FTOD%5DDwbAnWM%40WFk_ArXmDj%40g%40J%5DVkF%60Get%40%7Cz%40eT%7CV_%40%60%40Mv%40e%40jBWr%40%5Df%40yRjU%7DDvC%7BFbCyLlG%7DT%5EcQwEioBquA%7B%40uB%3FwDyBoA_EoCeDrAqWwQsa%40eYa%60Aiq%40_IwFgw%40_q%40O%7BBd%40gDwHqEoIqCWIyk%40%7Db%40aq%40id%40iB_B%7D%40w%40%5DwDkGcEkAIqRuAoNmAe%40hDcAhE%7BPq%40cQpAqR%60EiQrK%7DOhLyRrQke%40dc%40sj%40f_%40cBpBwCP%5C%5CsPcQl%40aHzDcV%60VgIjFqGnCg%7C%40%7EQqM%60AOvBu%40nr%40wC%60qBiH%60hC_Dno%40s%40xRm%40b%5C%5C%3Fvg%40d%40tu%40G%60z%40%7D%40dReD%7EUaCpUsKjrA%7DJn%7B%40m%40fL%5C%5Cvm%40Mth%40vWmQju%40uf%40xRqN%22%2C%22range%22%3Atrue%7D

@kevinkreiser
Copy link
Member

I'm wondering if the url encoded polyline is somehow tripping this up. like perhaps undefined behavior can occur when the url decoded polyline gets polyline decoded into bogus values. have you tried POSTing this instead of GETting it? Avoiding url encoding issues is IMHO well worth the trouble of using POST

@kevinkreiser kevinkreiser self-assigned this Jul 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants