vendredi 26 janvier 2018

Read String Array in Django API

I have EmberJS front-end which calls Django REST API. I am passing string array from front-end to the API as shown below:

Back-end Request http://localhost:8000/api/v1/User/search/?active=true&city%5B%5D=newyork&city%5B%5D=chicago&city%5B%5D=boston

HTML Decoded http://localhost:8000/api/v1/User/search/?active=true&city[]=newyork&city[]=chicago&city[]=boston

Some how I am not able to get rid of the extra %5B%5D (which is square brackets) from this request as EmberJS automatically adds that as the parameter is passed as string array. I searched over several forums but did not get a solution for it.

How to read the string array (City parameter) in Django API and get all passed values from EmberJS front-end?




Aucun commentaire:

Enregistrer un commentaire