I´m creating a small Node.js application which calls some REST api´s using Superagent (v. 5.1.2). I need to send a filter option with a get request.
The API endpoint needs the following structure:
endpoint-url/test?filter=_name eq 'testname'
I´m struggling to achieve this result using superagent with the built-in query method. When I send the request I´ll get all items returned, so the filter option isn´t making any effect. Once I test it via postman I´ll get just the specified item returned with the _name = 'testname'. The variable name down in the code has the value 'testname'.
I´m creating a small Node.js application which calls some REST api´s using Superagent (v. 5.1.2). I need to send a filter option with a get request.
The API endpoint needs the following structure:
endpoint-url/test?filter=_name eq 'testname'
I´m struggling to achieve this result using superagent with the built-in query method. When I send the request I´ll get all items returned, so the filter option isn´t making any effect. Once I test it via postman I´ll get just the specified item returned with the _name = 'testname'. The variable name down in the code has the value 'testname'.
Here is my code snippet
superagent.get('endpoint-url/test').authBearer(token).query({'filter': '_name eq ' + name}) .then(res => {...}).catch(err => {...});