unicefuganda/rapidsms-ureport

Support for '%'s in url /api/v1/ureporters/... routes

justinvdm opened this issue · 3 comments

Requests to /api/v1/ureporters/vumi_go_test/123/polls/current seem to work send us the correct response, but requests to /api/v1/ureporters/vumi_go_test/%2B123/polls/current seem to return the fallback 404 page response. Requests to /api/v1/ureporters/vumi_go_test/%2B123 seem to work though, so I think this may only be an issue with some of the /api/v1/ureporters/... routes, /api/v1/ureporters/<backend>/<user_addr>/polls/current being one of them.

In case it helps, here is the docs for the api, and here's the requests we tried (and the responses we got back):

[
  {
    "request": {
      "method": "GET",
      "url": "/api/v1/ureporters/vumi_go_test/%2B123"
    },
    "response": {
      "code": 404,
      "body": {
        "reason": "Ureporter not found",
        "success": false
      }
    }
  },
  {
    "request": {
      "method": "GET",
      "url": "/api/v1/ureporters/vumi_go_test/%2B123/polls/current"
    },
    "response": {
      "code": 404,
      "body": "(404) <!DOCTYPE html> ..."
    }
  },
  {
    "request": {
      "method": "GET",
      "url": "/api/v1/ureporters/vumi_go_test/123/polls/current"
    },
    "response": {
      "code": 200,
      "body": {
        "poll": {
          "type": "none",
          "question": "Welcome to U-report!, U-report is a FREE service that helps youth speak out on issues in their communities using SMS. SPEAK UP and BE HEARD!",
          "id": null,
          "name": "Message"
        },
        "success": true
      }
    }
  }
]

Handled, sory for delay

On Fri, Feb 21, 2014 at 5:40 PM, Justin van der Merwe <
notifications@github.com> wrote:

In case it helps, here is the docs for the apihttp://vumi-ureport.readthedocs.org/en/latest/ureport-api.html#contents,
and here's the requests we tried (and the responses we got back):

[
{
"request": {
"method": "GET",
"url": "/api/v1/ureporters/vumi_go_test/%2B123"
},
"response": {
"code": 404,
"body": {
"reason": "Ureporter not found",
"success": false
}
}
},
{
"request": {
"method": "GET",
"url": "/api/v1/ureporters/vumi_go_test/%2B123/polls/current"
},
"response": {
"code": 404,
"body": "(404) ..."
}
},
{
"request": {
"method": "GET",
"url": "/api/v1/ureporters/vumi_go_test/123/polls/current"
},
"response": {
"code": 200,
"body": {
"poll": {
"type": "none",
"question": "Welcome to U-report!, U-report is a FREE service that helps youth speak out on issues in their communities using SMS. SPEAK UP and BE HEARD!",
"id": null,
"name": "Message"
},
"success": true
}
}
}]

Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-35735512
.

Thanks for working on this :) Closing ticket.