Invalid json response

9 views
Skip to first unread message

osks

unread,
Aug 27, 2009, 5:28:47 AM8/27/09
to contextvoice-dev
I encountered a case where the json response from "add url" is invalid
(the parser we use is picky). My request looks like this (except for
the apikey):

---
POST /1.1/resources/ HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: api.contextvoice.com
Content-Length: 143

format=json&apikey=abc123&url=http%3A%2F%2Fdi.se%2FAvdelningar
%2FArtikel.aspx%3FO%3DRSS%26ArticleId%3D2009%5C08%5C26%5C349880
---

I get this response from your API:

---
HTTP/1.1 302 Found
X-Lighty-Magnet-Uri-Path: /1.1/resources/
X-Mashery-Responder: proxyworker-i-e42da68d.mashery.com
Content-Type: application/json
Server: lighttpd/1.4.19
Location: 1.0/resources.json/?url=http://di.se/Avdelningar/
Artikel.aspx?O=RSS&ArticleId=2009\08\26\349880
Date: Thu, 27 Aug 2009 09:03:28 GMT
Accept-Ranges: bytes
Content-Length: 150

{ "info": { "message": "Resource found.", "url": "1.0/resources.json/?
url=http://di.se/Avdelningar/Artikel.aspx?
O=RSS&ArticleId=2009\08\26\349880" } }
---

I believe that the problem is the "\" in the URL. In our request, the
URL is properly encoded, but none of the URLs we've gotten back have
had URL-encoded query string values, so I suspect this could be a
problem with other characters as well.

Vladimir Oane

unread,
Aug 27, 2009, 11:12:53 AM8/27/09
to contextv...@googlegroups.com
It should be ok now. Try it again.

osks

unread,
Aug 27, 2009, 11:18:08 AM8/27/09
to contextvoice-dev
Yes, it seems to work well now. Many thanks for the fast response!

On Aug 27, 5:12 pm, Vladimir Oane <vladimir.o...@gmail.com> wrote:
> It should be ok now. Try it again.
>
> On Thu, Aug 27, 2009 at 12:28 PM, osks <oskar.sk...@gmail.com> wrote:
>
> > I encountered a case where the json response from "add url" is invalid
> > (the parser we use is picky). My request looks like this (except for
> > the apikey):
>
> > ---
> > POST /1.1/resources/ HTTP/1.1
> > Content-Type: application/x-www-form-urlencoded
> > Host: api.contextvoice.com
> > Content-Length: 143
>
> > format=json&apikey=abc123&url=http%3A%2F%2Fdi.se%2FAvdelningar
> > %2FArtikel.aspx%3FO%3DRSS%26ArticleId%3D2009%5C08%5C26%5C349880
> > ---
>
> > I get this response from your API:
>
> > ---
> > HTTP/1.1 302 Found
> > X-Lighty-Magnet-Uri-Path: /1.1/resources/
> > X-Mashery-Responder: proxyworker-i-e42da68d.mashery.com
> > Content-Type: application/json
> > Server: lighttpd/1.4.19
> > Location: 1.0/resources.json/?url=http://di.se/Avdelningar/
> > Artikel.aspx?O=RSS&ArticleId=2009<http://di.se/Avdelningar/%0AArtikel.aspx?O=RSS&ArticleId=2009>
> > \08\26\349880
> > Date: Thu, 27 Aug 2009 09:03:28 GMT
> > Accept-Ranges: bytes
> > Content-Length: 150
>
> > { "info": { "message": "Resource found.", "url": "1.0/resources.json/?
> > url=http://di.se/Avdelningar/Artikel.aspx?
> > O=RSS&ArticleId=2009<http://di.se/Avdelningar/Artikel.aspx?%0AO=RSS&ArticleId=2009>\08\26\349880"
Reply all
Reply to author
Forward
0 new messages