Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Passing single quotes as an actual value in rest jsom

NM
Esteemed Contributor
Esteemed Contributor

Hi Team, has anyone passed single quotes as an actual value in rest json?

I tried using backslash but didn't work.

Thanks

 


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'
13 REPLIES 13

rushikeshvartak
All-Star
All-Star

Share json


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak we need to pass a script in http param

Param looks like.

Script:select username, ID from user wher username ='name' and we need to add name in single quotes


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

Add blackslash


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak tried that .. couldn't save the connection.


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

Share error logs / json


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak here is the json not working with backslash

{
"name": "call1",
"connection": "acctAuth",
"url": "",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "${\"Script\":\"Select Username, ID, status, email, displayname, sourceds from User where upper(username) = upper('+'\''+abc+'\''+') ORDER BY Username\"'}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
404,
401,
400
]
}
}


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

"httpParams": "${\"Script\":\"Select Username, ID, status, email, displayname, sourceds from User where upper(username) = upper('\\\\'abc\\\\') ORDER BY Username\"}",


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak need to add single quotes in json


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

Its added in above logic


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak it is adding backslash instead of single quote

\"Script\":\"Select Username, ID, status from user where upper(username) = upper(\\abc\\)

abc is dynamic value which we are picking from task account name


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'


"httpParams": "{\"Script\":\"Select Username, ID, status, email, displayname, sourceds from User where upper(username) = upper('\" + abc + \"') ORDER BY Username\"}"


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

@rushikeshvartak , i have already tried above...

i was able to make it work. will share the working one just testing few scenarios.

Thank you!!


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

NM
Esteemed Contributor
Esteemed Contributor

working Json

"httpParams": "{\"Script\":\"Select Username, ID, status, email, displayname, sourceds from User where upper(username) = upper('\\\" + abc + '\\\''+') ORDER BY Username\"}

 

Thank you so much @rushikeshvartak for always helping out.


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'