I have been retriving this error multiple times jasonpath name doesnt match - rest-assured

Below is the error that is generating. I am trying to extract name and value from the JSON body!
I am expecting in console name and value

Your path to extract value is wrong. The correct path would be .body("data.name", equalTo("jeetu"));

Related

Cannot bind query parameter; Unknown name basicRequest when retrieving basic insights for a location

I'm trying to retrieve insights for a location using the Google Business Profile API. I've tried a few approaches, but I always get an error about "Cannot bind query parameter".
According to the docs, I should be posting to this URL: https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights
and in the body, pass in an array of locationNames, but when I do that, I get the error about "Cannot bind query parameter 'locationNames'".
So I just tried doing a GET on this URL and pass in the names on the name querystring and that worked just fine to get the high-level data.
https://mybusiness.googleapis.com/v4/accounts/xxx/locations:reportInsights?name=accounts/xxx/locations/xxx
So I know I have the right account ID, location ID, etc. But I need to be able to add in the basicRequest parameter so I can indicate which metric that I want to retrieve.
So I've POST to both of those URLS above with a body that looks like this:
{"basicRequest":{"metricRequests":[{"metric":"ALL"}],"timeRange":{"startTime":"2020-10-12T01:01:23.045123456Z","endTime":"2022-01-10T23:59:59.045123456Z"}}}
But again, I get the same errors about "Cannot bind query parameter" to field "basicRequest" (Same as when I tried to pass in the "locationNames" param in the JSON.
So clearly, I'm doing something wrong with how I am sending in the parameters in the body because it doesn't seem to think any of those parameter names are valid. My end goal is to be able to retrieve queries_direct, actions_total, etc.
I'm using Ruby, and there isn't a client library for it, so I'm just crafting the URLs and the JSON body and doing a GET or POST to it.
Greatly appreciate any pointers!

Thymeleaf th:text displaying wrong value on encoded parameter

The URL of the template is:
http://localhost:8080/login?error=Usu%E1rio%20inexistente%20ou%20senha%20inv%E1lida
where, for example, %E1 is á
I'm trying to display the value of the param error on the page using this code:
but a wrong value with special character is being displayed.
Welcome to SO.
I see two ways you can try:
1) Use the utility for an HttpServletRequest:
<p th:utext="${#httpServletRequest.getParameter('error')}">[error message]</p>
This is getting the value of the error parameter from the request.
2) Use the typical usage for getting the value of a param:
<p th:utext="${param.error}">[error message]</p>
In either case, you can use th:if to check for null. You can use utext to get the unescaped text so that unusual characters display.
Also, check that your character encoding is set to UTF-8. In your config, it would look something like:
resolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
or
resolver.setCharacterEncoding("UTF-8");
Instead of trying to decode the URL, I first encoded the error message where it was generated using URLEncoder.encode(errorMessage). So, the URL changed to http://localhost:8080/login?error=Usuário+inexistente+ou+senha+inválida. Then, I didn't need to decode. I only used th:text="${param.msgError}

Rails: parse weirdly-formatted JSON

My JSON response from an external service looks like this:
Parameters: {"{\"attributes\":{\"type\":\"Lead\",\"url\":\"/services/lead/2231\"},\"Id\":\"2231\",\"FirstName\":\"Jean\"}"=>nil, "external_id"=>"2231"}
How can I parse the Id and FirstName keys in Rails 5? I've tried everything. I know Rails 5 has the .to_unsafe_h method, that's not my problem. It's more the weird nested formatting that has a value of nil after "Jean" above.
If you pay attention closely, you will see:
"{\"attributes\":{\"type\":\"Lead\",\"url\":\"/services/lead/2231\"},\"Id\":\"2231\",\"FirstName\":\"Jean\"}" is actually a string, a key, and the value value associated to it is nil.
If you want to parse that, just can use parameters.keys[0].to_json; although I will double check first why you are getting the parameters in that incorrect state in the first place.

How to get an empty parameter from an url like "example.com/id//"?

I am using symfony 1.0 and below is the URL which displays the news description.
http://news4u.com/search/news/id/344158/css//act/n
In the above URL value for CSS is missing and the URL is supposed to be as below
http://news4u.com/search/news/id/344158/css/n/act/n
When I use $this->getRequestParameter('css') to get the value of css, I get it as 'act' and if the do the same for 'act', I get empty value.
$getRequestParameter('css')=act
$getRequestParameter('act')=<EMPTY>
I am getting values for above parameters for the metioned URL.
I want to get value of 'act' in above URL. How to get that?

I am validating for RegEx errors -- how can I return which keyword, it failed on?

I'm passing new objects through this set of regex :
(?i)exp\s|(?i)expire\s|(?i)print|(?i)mention|(?i)spring|(?i)summer|(?i)winter|(?i)jan(\s|\.)|(?i)january|(?i)february|(?i)feb(\.|\s)|(?i)march|mar(\.|\s)|(?i)april|(?i)june|(?i)july|(?i)august|(?i)aug(\s|\.)|(?i)september|(?i)sept(\.|\s)|(?i)november|(?i)nov(\.|\s)|(?i)december|(?i)dec(\.|\s)|(?i)holiday|(?i)christmas|(?i)holloween|(?i)easter|(?i)season|(?i)ends|(?i)end
If it errors, for example on the word christmas , how can I dynamically pull the word it errors on, and display it as the cause of the error?
$~ will be set to a MatchData object. If you then call $~.captures, you should get an array of matches.

Resources