I am trying to get organizations resource for Name = 'G&A' using the following API
https://xxx/hcmCoreSetupApi/resources/11.13.18.02/organizations/?onlyData=true&q=Name='G&A'
But getting an error "URL request parameter A' cannot be used in this context."
Thank you for the help in advance
The ampersand & character is used as a separator between query parameters. If you want to pass an ampersand as part of a query parameter's value then use the equivalent hexidecimal code %26 instead of &:
https://xxx/hcmCoreSetupApi/resources/11.13.18.02/organizations/?onlyData=true&q=Name='G%26A'
However, that is still invalid as you have too many equals = characters in that string; so did you intend to have three parameters named onlyData, q and Name? Then you would encode them like this:
https://xxx/hcmCoreSetupApi/resources/11.13.18.02/organizations/?onlyData=true&q=&Name='G%26A'
Or, if you really had intended to have two parameters named onlyData, q=Name then you would need to encode the equals = character in the parameter name as well:
https://xxx/hcmCoreSetupApi/resources/11.13.18.02/organizations/?onlyData=true&q%3DName='G%26A'
Or, if Name= is part of the value not the key then:
https://xxx/hcmCoreSetupApi/resources/11.13.18.02/organizations/?onlyData=true&q=Name%3D'G%26A'
Related
I am trying to filter rows with: name eq 'nameFromQueryData'
One name is breaking the filter: Paul O'Meefe
Its due to the filter needing to escape the ' inside the name. Its reading it as: name eq 'Paul O' (end string) Meffe' (start string) = error
Since this is dynamic data, I cant just use the escape character O/'.
So how would one go about escaping it?
Try using fetchxml instead - it's a lot more adaptable and forgiving instead of an odata query in Power Automate
enter image description here
"<LDAP://DC=top,DC=example,DC=com>;(&(objectCategory=person)(objectClass=user)(sn=%lastname%));sAMAccountName,sn,givenName,distinguishedname,userAccountControl,cn"
Above is a snippet of my query that I will send to AD. When I type an EXACT last name, it works without issues. However when I enter a partial last name, I get no results.
Can anyone please tell me how to perform a search on a partial name?
% is not a valid wildcard in LDAP filters, and you also can't use environment variables (%variable%) in VBScript LDAP queries. A filter with a partial value can be defined like this:
(&(objectCategory=person)(objectClass=user)(sn=*something*))
If you want to use a variable in a filter you have to use string concatenation:
"(&(objectCategory=person)(objectClass=user)(sn=" & variable & "))"
I'm trying to create a script that will take a URL out of a response and send it out again.
Using the regular expression extractor I've succeeded in taking the wanted URL, but it holds "&" so naturally when sending it out the request fails.
Example:
GET http://[ia-test01.inner-active.mobi:8080/simpleM2M/ClientUpdateStatus?cn=WS2006&v=2_1_0-iOS-2_0_3_7&ci=99999&s=3852719769860497476&cip=113-170-93-111&po=642&re=1<=0&cc=VN&acp=&pcp=]/
I'm trying to replace the "&" with a "&".
I've tried: ${__javaScript(${url}.replace("&","&"))}
But it did not work. I've tried the regex function as well- the same.
I'm not sure the IP field in the request supports the us e of functions.
I'm currently trying to use the beanshell post-processor. But I'm pretty sure there is a simpler solution I'm missing.
Not sure what you're trying to get by replacing & with & however will try to respond.
First of all: given multiple & instances you need to use replaceall function, not replace
Second: replace / replaceall functions take a RegEx as parameter, so you'll need to escape your &
If you're trying to substitute URL Path in realtime, you'll need Beanshell Pre Processor, not the Post Processor
Sample Beanshell Pre-Processor code
import java.net.URL;
URL myURL = sampler.getUrl();
String path = myURL.getPath();
String path_replaced = path.replaceAll("\\&", "&");
vars.put("NEW_PATH", path_replaced);
After that put ${NEW_PATH} to "Path:" section of your HTTP Request.
Hope this helps.
Solution with less code:
Install the Custom JMeter Functions plugin
Use the following syntax
${__strReplace(ImAGoodBoy,Good,Bad,replaceVar)}
‘ImAGoodBoy’ is a string in which replacement will take place
‘Good’ is a substring to be replaced
‘Bad’ is the replacement string
‘replaceVar’ is a variable to save result string
Refer this URL for more info!
Thank a lot. However, i see from a recent experience that to replace a character that is actually a RegExp special character, like \ " ( ) etc, you need to put 3 backslashes and not 1, not 2. This is weird.
so you write
var res = str.replaceAll("\\\\u003c", "<");
to replace \u003c with <
I am trying to get the user information from a table (named userinfo) from the Oracle database on the basis of name.
In database name can be like {"Ashwani Dahiya","Ashwani kumar","ashwani dahiya","ashwani kumar","Ashwani dahiya","ashwani Dahiya","ashwani"}
So I want if I search for name "ashwani" then it should return the above whole list of users
select *
from userinfo
where regexp_like('name','Ashwani([[:space:]]* | [[:space:]]+[a-zA-Z0-9]*)','i')
I had tried this but "no result found".
This expression
regexp_like('name','Ashwani([[:space:]]* | [[:space:]]+[a-zA-Z0-9]*)','i')
searches inside the string 'name' not inside a column called name. When you want to refer to a column you don't need quotes.
So you need your expression to:
regexp_like(name,'Ashwani([[:space:]]* | [[:space:]]+[a-zA-Z0-9]*)','i')
(Note the missing single quote ' around name).
But I don't see the need for a regex here. a simple
where lower(name) like '%ashwani%'
will also do the trick (and will not be slower than the regex because neither of them will use an index)
I assume you meant to use the column called NAME and not the literal 'name' so try without the quotes around name and also lose the spaces around the "|":
select * from userinfo where regexp_like(name,'Ashwani([[:space:]]*|[[:space:]]+[a-zA-Z0-9]*)','i')
Note that for testing purposes you can try it with literals like so:
select *
from dual
where regexp_like('ashwani ','Ashwani([[:space:]]*|[[:space:]]+[a-zA-Z0-9]*)','i')
As mentioned by a_horse_with_no_name, you may get away with using the "LIKE" but I'm guessing you're looking for just "ashwani" and not "ashwaniX" (where X is some other letter) in which you could have just
lower(name) = 'ashwani'
or lower(name) LIKE 'ashwani %'
The trouble with regex functions is that they can be rather slow if you're working with a lot of data.
if you wish to cling to regexes, try
select *
from userinfo
where regexp_count(name, '^ashwani', 1, 'i') = 1
;
but there really is no need for if the matches will always start with the literal to compare against.
I am a newbie to Pentaho (installed today). I was able to do basic transformation in Spoon. Now I need to do some stuff, which I can't figure out how.
my input looks like
2012-09-17|garima|fbhjgjhgj87687jghgj88jgjj|garima#1347868164626|::ffff:120.56.132.137
3rd field is an ID, for which I need to get some information from a REST API
http://api.app.com/app/api/v1/feature/fbhjgjhgj87687jghgj88jgjj
What do I need to do in Spoon to get this done?
Also, data return will be in json format. how do I parse that?
You should first get your input with a CSV File Input using | as delimiter. Then you can get the 3rd field as a string.
Next you probably need to remove all spaces from this string with a String operations step. Look at the Remove special character column, and select space.
Then you need to concatenate it with your http address http://api.app.com/app/api/v1/feature/. For this you'll use a Calculator step. At this step first create a new temporary field tmpAddr, with operation Define a constant value for ... (or something like this, sorry my spoon is in portuguese). At the Field A column you'll write your http address. It's a good practice, after you make this work, to set your address as a system variable so if it changes you don't need to replace it everywhere on your transformations (look at menu Edit -> System Variables).
Now on the same Calculator step create another field, let's say MyAddress, with operation A+B. Choose for Field A the field tmpAddr you just created, and for Field B the 3rd field from your input.
Now on your stream you should have the full address as a field MyAddress. Connect a REST client step. Mark Accept URL from field and choose field MyAddress as URL Field Name. Set Application Type to JSON. Set Result Fieldname as MyResult.
If you need further JSON parsing you can add a Json input step. Set Source is defined in a field and select field MyResult as Get Source from field.
An alternate approach is to use the "Replace in String" step to append the string.
Set 'use RegEx' to Y
Set 'Search' to (.*)
Set 'Replace with' to http://api.app.com/app/api/v1/feature/$1
Set 'Whole Word' to Y
The parentheses in the regex set up a capture group that you can then insert into your replacement string with the $X syntax