I have recently started working with SPARQL and JMeter. I was trying to load test Stardog. For that I used Jmeter and ran a SPARQL query which updates a value in the database, using HTTP Request. I tried running the Query in Stardog web interface and it changes the value in the DB just fine. When I run the same query using Jmeter it runs just fine but does not change the values in the DB. It would be very helpful if I knew what I am doing wrong. The query I am running is:
PREFIX info: <http://somewhere/peopleInfo#>
PREFIX vcard:<http://www.w3.org/2001/vcard-rdf/3.0#>
DELETE { ?person info:age ?age }
INSERT { ?person info:age ?nage }
WHERE {
?person vcard:FN 'Becky Smith' .
?person info:age ?age
BIND (?age+1 AS ?nage)
}
The screenshots of Jmeter can be found here:
https://onedrive.live.com/redir?resid=E29D7716CE8E7022!239767&authkey=!AEzPJtZJi-bbmjw&ithint=folder%2cpng
The rdf file I am using in Stardog can be found here (https://onedrive.live.com/redir?resid=E29D7716CE8E7022!239766&authkey=!ALBbaxM8nHhAXSw&ithint=file%2crdf).
Any help will be greatly appreciated. Thank you.
[Sorry for uploading Onedrive links, I am a new user and do not have enough reputation points to upload more than 2 links.]
I've not used JMeter, so I don't have any definitive answer on what precisely is wrong with your configuration, but I can see that there is some issue with it.
The expected format for submitting a POST to Stardog's query endpoint is that the Content-Type is application/x-www-form-urlencoded and the body should be the query parameters sent to the endpoint. So, like with a GET request, it's expecting that to be query=<your query>. Looking at the second screenshot, it doesn't like that's configured correctly.
This is confirmed by the response type of text/turtle and the response content of Stardog's SPARQL service description, which is what Stardog sends when the request is missing the query parameter.
I realized the mistake I was making. I was using HTTP Body to paste my SPARQL code. Instead when I used Parameters and added the SPARQL code under Query. It should look like the picture.
Parameter
Related
Hello I am trying to insert an object into elasticsearch using it's API, the problem is that the IDs of elements that I want to insert are like this : ee5z4d5/54zd15zd/5zd45
when I sent a post request to host/index/id with a body, I got an error because the request url is host/index/ee5z4d5/54zd15zd/5zd45
I am using spring boot with feign client to comminucate with elasticsearch, and my question is how I can solve this problem
You need to URL-encode your ID first, i.e. the URL must look like this
host/index/ee5z4d5%2F54zd15zd%2F5zd45
I don't know Feign but this issue might provide some insights on how to solve your issue.
Tldr;
This is not an Elastic issue but more a web issue.
What you need to do, is encode the special char in the url.
Look at the solution below to find out what it means.
Solution
POST /73690410/_doc/ee5z4d5%2F54zd15zd%2F5zd45
{
"data": "my id has some slash"
}
How to parameterize request if I am getting something similar to the following for login POST request in body data tab.
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"testuser\"},\"password\":{\"digest\":\"5811c74a581ffdb892ab9eddfb9cf2d21772a98332a59de6aa26989e01f84057\",\"algorithm\":\"sha-256\"}}],\"id\":\"7\"}"]
It's generally easy to correlate when we are getting in Parameters TAB, but in cases how we can proceed? For all further requests - it's the similar case.
I tried to switch to Parameters TAB, but it says that it can not be converted to that format.
So How we can proceed?
The same way, just substitute hard-coded (recorded) values with the relevant JMeter Variables directly in the request body like:
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"${username}\"},\"password\":{\"digest\":\"${password}\",\"algorithm\":\"sha-256\"}}],\"id\":\"${id}\"}"]
The most commonly used for parameterization test element is CSV Data Set Config, however other options exist.
I need to send POST request through jmeter. I have checked the requests workflow through browser dev. tools. In my Post request I need to send form data and one string Query. Question is next - if i will add my string Query to URL will it work fine?
Example : somesite.com/something?refURL=someRef
If it is a POST request, usually any form data will be sent in the request body. Not like a query string in the GET request. But the format is same.
refURL=someRef add this in the parameters section.
Check here for more info.
https://www.w3.org/TR/html401/interact/forms.html#h-17.13
Why not? Query string and request body are different beasts and they are processed differently on server side.
Instead of asking this kind of questions, why don't you just record your test using JMeter's proxy server?
References:
URI Syntax - Query Component
HTTP Method Definitions - POST
Yes it will.
You can even use variables like:
/some/path?refURL=${someCalculatedRefUrl}
I've used Fiddler to capture these HTTP calls. Here's the problem:
I have a HTTP-POST data that looks like below:
Notice how it has many 'employeeIds' and also 'shiftSumIds'.
Now, these Ids are from a previous HTTP response that looks like below:
Is there an easy way to extract those Ids and prepare the POST data? Thanks in advance.
--Ishti
Short answer is JSON Path Extractor available via JMeter Plugins which is designed for getting "interesting" values from JSON data. See Using the XPath Extractor in JMeter guide (look for "Parsing JSON" chapter) for installation instructions and some form of JSON Path language reference.
If it is not enough and you will need some assistance in constructing JSON Path query and building HTTP Request from it - please include text version of response and request using i.e. http://paste.org service as reading large amount of text from small screenshot isn't very handy and chance of getting the answer is minimal
We use the Result format (from the Search Protocol) for our results page (we manually parse the XML responds). We wishes now to switch to the Dynamic Result Clusters format. The only problem is that spelling suggestion (Related Queries) doesn't seem to be available using that protocol.
The only solution I seem to find is to:
First do a /clusters... request. If the request return no result...
...to another request to /search... to see if that request would return a spelling suggestion (Related Queries).
Am I missing something? Can the Clusters format return also spelling suggestion?
Got it.
/clusters request are not to be use instead of the /search request.
You must :
First, do a normal /search request.
Then, do a AJAX request to /clusters to produce the suggestion.
So you keep all the features of the /search request (KeyMatches, Related Queries, etc).