Why won't my Angular front-end pass correct $http.get parameters to Django back-end?
<p>I have a Web Application made up of front-end client written in Angular/Javascript and a back-end server written in Python/Django. </p>

<p>I'm trying to do a simple http GET request from the client to the server and it is not working. The reason it is failing is because for some unknown reason, the parameters are not being passed correctly.</p>

<p>Here is the line of code being called on my client:</p>

<pre><code>  $http.get(API + '/api/getProfile', {'profileId':5}).then(console.log('A'), console.log('B'));
</code></pre>

<p>And here are the relevant lines of code on my server:</p>

<pre><code>class GetProfileAPI(views.APIView):
    def get(self, request, *args, **kwargs):
        logger.info("request.get_full_path() = %s" % request.get_full_path())
        profile_id_arg = request.GET.get('profileId')
        logger.info("profile_id_arg = %s (%s)" % (profile_id_arg, type(profile_id_arg)))
        # Do something here if profile_id_arg is not None.
</code></pre>

<p>When I run this code, I expect <code>profile_id_arg</code> on the server side to be the string <code>5</code>. But instead look at the output that I get:</p>

<pre><code>request.get_full_path() = /api/getProfile
profile_id_arg = None (&lt;type 'NoneType'&gt;)
</code></pre>

<p>Why isn't <code>profile_id</code> being received properly and how can I fix this? Code example would be helpful.</p>

<p>A HTTP GET request can't contain data to be posted to the server. However you can add a query string to the request.</p>

<pre><code> $http.get(API + '/api/getProfile', {params:{'profileId':5}})
      .then(function (response) { /* */ })...
</code></pre>

<p>OR</p>

<pre><code>$http({ 
     url: API + '/api/getProfile', 
     method: "GET",
     params: {'profileId':5}
  });
</code></pre>

<p><a href="https://docs.angularjs.org/api/ng/service/$http#get" rel="nofollow">check here1</a> and <a href="https://docs.angularjs.org/api/ng/service/$http#usage" rel="nofollow">check here2</a></p>

javascript python angularjs django http-get