Variable Path Param for GET request in Jmeter - api

I'm testing a GET request using Jmeter, this request has path parameter:
rest/V1/autobusca/marketplace/product/:productSku
I'm trying to send the parameter in two different locations
Send Parameters With the Request
And I insert a "User Parameters" as productSku and the value.
I noticed the code response is 200, but the body response is "[]", but when I send it using Postman the response body has a lot of information.
If I change the path in the request like this:
rest/V1/autobusca/marketplace/product/${productSku}
I noticed the code response is 404. Can you help me?

Use "//" instead of "/".
Correct URL will be : rest/V1/autobusca/marketplace/product//${productSku}

Related

How to get an api get request's query parameter using Playwright-Java

Context :
Trying to intercept and Replace a browser get request's query string parameters using playwright java.
I am able to print the URL of the get request along with the query string parameters using page.onRequest
Issue:
Please help me find a method in the request object that could retrieve the query string parameters in the payload section or any other way to intercept and Replace a browser get request's query string parameters.
PFB Playwrights available methods in the request object
PFB the Network tab log of the fired get request

Rest assured is giving 502 in return

I have simple get API
https://abc.xyz.co/index.php?route=efg/api/jkl&key=8454jdgdkjf948754&source=android&user_id=44
when i hit in browser I receive 200 OK but when i send request using rest assured it gives 502 in return.
Below is the code I am using
RestAssured.baseURI = "https://abc.xyz.co/";
RequestSpecification request = RestAssured.given();
Response response = request.queryParam("route", "efg/api/jkl").
queryParam("key","8454jdgdkjf948754").
queryParam("source","android").
queryParam("user_id","44").get("/index.php");
System.out.println(response.getStatusCode());
Someone please look into this
Note: URL shared is dummy URL but format is same as per my project
I think the problem is in base url and endpoint url:
"https://abc.xyz.co/"
"/index.php"
which gives together "https://abc.xyz.co//index.php", so one slash character "/" is redundant. Try to remove it either for base url or endpoint url and it should work.

Request mandatory for POST method call in Karate

Today I came across a scenario where there was a POST method call but that does not require a request data and query parameters are sufficient. But in Karate framework it is mandatory to give request data when it is POST method. So I had to provide request as 'null' explicitly. Is there any way in Karate that if there is no request data then you can skip providing request data as 'null'.
This is what I usually do if there's no request body :
Given path '/path/to//action'
And request ''
When method post
Then status 200
(Haven't found a way to skip the request step)
I tried this way:
Given url 'url'
And params param_value
And request '{}'
When method post
Then status 200
Its same as mentioned above just I gave empty request body

API: Custom 404 not found error response structure

Considering this url: http://example.com/users/1/post/2/likes.
How can I correctly define structure of my 404 response, showing which item is not found? user, post or likes?
You can send an HTTP status code using the header() function, by starting the header with the status code number, followed by the message to send to the user.
header("404 " + $message);
The code that processes the parameters can determine which item isn't found, and put that into $message.

How to pass regular expression extracted value in json format for PUT call in jmeter?

I am testing RESTapi with (json format) using (HTTP Request sampler) in jmeter. I am facing problems with the PUT calls for update operation.
The PUT call with parameters don't work at all using (HTTP Request sampler), so now i am using the post body to pass the Json.
How can i pass the extracted values from the previous response to next PUT request in thread group? Passing the 'Regex veritable' to PUT call in Post body don't work, it doesn't take ${value} in Post body.
How do i carry out UPDATE operations using (HTTP Request sampler) in Jmeter?
Check that your regexp extractor really worked using a debug sampler to show extracted value.
Check your regexp extractor is scoped correctly.
See this configuration:
A Variable:
Its use with a PUT request:
The sampler result: