3

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?

mafortis
  • 6,750
  • 23
  • 130
  • 288

1 Answers1

1

Try this:

    return this.http
          .get(`${this.env.HELPDESK_LIST_FILTER}[{ "value": "${value}", "field": "${column}", "sort": "${sort}", "op": "${filter}" }]`, params)
          .pipe(map((data) => data));
sonEtLumiere
  • 4,461
  • 3
  • 8
  • 35