Agent calls readpeaker api and gets 302 document has moved

however calling the same api url from postman (chrome plugin to simulate get/post requests) it works ok

my agent code following github example
url <- format(“”, http.urlencode(data));
headers<-{ “Content-Type” : “text/xml” };
http.get(url,headers).sendasync(function(resp) {

if (resp.statuscode == 200) {
    server.log("sending audio to imp");
    //device.send("audio", resp.body);
} else {
    server.log(format("ERROR %li: %s", resp.statuscode, resp.body));


the error

this is the server.log(url)

than the server.log(format(“ERROR %li: %s”, resp.statuscode, resp.body));

2014-08-12 22:21:30 UTC+1 [Agent] ERROR 302: The document has moved a href=“”>here.

The agent won’t automagically redirect (which is what a 302 response is).

It looks like their API endpoints, or how they return data has changed. When you get that 302 response, you’ll want to grab out the URL (it’s likely in a header as well), and then make a request to that endpoint.