I have api url like this:
https://example.com/api/tickets?filters=[{"field":"ticket_number","op":"like","value":"HT00002"}]
And I've created service function like this:
getTableFilter(column: string, sort: string, value: string) {
const accessToken = store.get('accessToken')
const params = accessToken
? {
headers: {
Authorization: `Token ${accessToken}`,
AccessToken: accessToken,
},
}
: {}
return this.http
.get(`${this.env.HELPDESK_LIST_FILTER}` + '[{field:' + column, + 'op:' + sort, + 'value:' + value + '}]', params)
.pipe(map((data) => data));
}
Note:
this.env.HELPDESK_LIST_FILTERis equal to'https://example.com/api/tickets?filters='in myenvfile
But I get this error

Any idea?
you have accidently apply more that two parameter try to stick with `` string format
this.http.get(`url`,params)
const url = `${this.env.HELPDESK_LIST_FILTER}[{field: ${column},op:${sort},value:${value}}]`;
const params = accessToken
? {
headers: {
Authorization: `Token ${accessToken}`,
AccessToken: accessToken,
},
}
: {};
return this.http
.get(url, params)
.pipe(map((data) => data));
The comma should be in the quote.
return this.http
.get(`${this.env.HELPDESK_LIST_FILTER}` + '[{field:' + column + ',op:' + sort + ',value:' + value + '}]', params)
.pipe(map((data) => data));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With