thinhle-agilityio / gatsby-source-apiserver

A gatsby source plugin for pulling data from api server.
63 stars 34 forks source link

Query parameters don’t work #15

Closed adityasrini closed 5 years ago

adityasrini commented 5 years ago

Hi there. It appears that you’re using the Axios library to formulate your requests. When I follow your readme doc to add request parameters to the API query, I don’t get the expected response and it’s as though the parameters weren’t appended at all.

Here’s the doc

params: {
        requestParameters: ['some', 'request', 'parameters']
      },

Here’s my API: https://api.dc-hsda.ml/organizations/ Query parameter is: per_page=1

Expected output: an array with one item Actual output: an array with all 50+ items

adityasrini commented 5 years ago

Note that this is how I’m formulating the parameters in the config file:

params: {
    per_page: 1
  }

I’ve tried all sorts of combinations such as per_page: '1', ”per_page”: '1', 'per_page': 1 etc with the same result.

thinhle-agilityio commented 5 years ago

I guess you're using version 2.0.0. params has been updated in version 2.1.0. So you can try to append query params to request url instead: https://api.dc-hsda.ml/organizations?per_page=1

adityasrini commented 5 years ago

That solved the problem! Looks like your README.MD needs to be updated with the right changelogs and/or version recommendations.