Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular API call with double quotation marks

I have service where I call API URL and my URL supposed to have ".." quotation mark around my values but it prints like %22%27 when I call the API, How can I have my double quotation marks as they are in my URL?

Code

return this.http
      .get(`${this.env.HELPDESK_LIST_FILTER}` + '[{ "value": ' + `'"${value}"'` + ', "field": ' + `'"${column}"'` + ', "sort": ' + `'"${sort}"'` + ', "op": ' + `'"${filter}"'` + ' }]', params)
      .pipe(map((data) => data));

My final URL supposed to be like this:

https://example.com/api/tickets?filters=[{"value":"una","field":"name","sort":"none","op":"like"}]

Instead it's like this now:

https://example.com/api/tickets?filters=[{%20%22value%22:%20%27%22una%22%27,%20%22field%22:%20%27%22name%22%27,%20%22sort%22:%20%27%22none%22%27,%20%22op%22:%20%27%22like%22%27%20}]

Any idea?

like image 674
mafortis Avatar asked Sep 09 '26 22:09

mafortis


1 Answers

Try this:

    return this.http
          .get(`${this.env.HELPDESK_LIST_FILTER}[{ "value": "${value}", "field": "${column}", "sort": "${sort}", "op": "${filter}" }]`, params)
          .pipe(map((data) => data));
like image 129
sonEtLumiere Avatar answered Sep 11 '26 12:09

sonEtLumiere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!