Jmeter: How to resolve Conflict message 409 in deleting a particular id - csv

I created a container with post Request and now i want to delete the container with container Id parameter.This is the error message i am getting .
could you tell me the reason for this conflict message in Delete HTTP Request

Since this is DELETE request/operation, 409 status code probably means you are not allowed to delete the entity. Check your user permissions and the specific entity requirements.

Most probably you have recorded your script and somewhere in generated HTTP Request samplers there is hard-coded ID of 1216 and when you're trying to replay your test with > 1 user your web application responds with HTTP 409 status code
Alternatively you're trying to update an item with again recorded hard-coded timestamp and your application refuses to do it as it's older than the current time.
So you need to revisit your HTTP Request sampler and either correlate the item ID or parameterize the timestamp using __time() function or both

Related

Update a session with Google Fit REST API

I can create successfully sessions with the Fit REST API.
But when I try to update one (ie change the name), it creates a new session, even if I use the previously created session ID in the url and in the request body (I do the exact same request as the session creation but I change only the "name" property's value).
The result is that I have 2 sessions with the same ID.
If I try to delete the session and the "copy", I get a response error with the message "Session already deleted".
Is there any way to correctly update a session?
You may refer with this documentation about Users.sessions. You need to use the update method which updates or inserts a given session.
HTTP request:
PUT https://www.googleapis.com/fitness/v1/users/userId/sessions/sessionId
Check the example and explanations here.

Exchange Webservices (EWS) UpdateItems error 503

if i try to update more than one appointment with the Service.UpdateItems methode the server returns an 503 error.
My Code:
service.UpdateItems(appointments,folderID,ConflictResolutionMode.AutoResolve, null, SendInvitationsOrCancellationsMode.SendToNone);
Updating a single appointment with the Appointment.Update methode works.
Has anyone an idea why Service.UpdateItems does not work ?
You may be getting throttled by Exchange by trying to execute too many updates at once. Try smaller batches - of 10 items, or try spacing your requests with longer breaks between them.
As it is described here, there are three response codes which may indicate a throtting problem:
HTTP Status 503 Indicates that EWS requests are queuing with IIS. The client should delay sending additional requests until a later time.
HTTP Status 500 - Indicates an internal server error with the ErrorServerBusy error code. This indicates that the client should delay sending additional requests until a later time. The response may contain a back off hint called BackOffMilliseconds. If present, the value of BackOffMilliseconds should be used as the duration until the client resubmits a request.
HTTP Status 200 - Contains an EWS schema-based error response with an ErrorInternalServerError error code. An inner ErrorServerBusy error code may be present. This indicates that the client should delay sending additional requests until a later time.

How to use responses from a Jmeter JDBC Request in a HTTP Request

Here's my situation:
I want to do this:
I have a list of URLs in a MySQL database which I want to hit using a HTTP Request to see if the response is a HTTP Status code of 404 or not.
I have done this:
Added and configured a JDBC Config Element.
Added and configured a JDBC Request Sampler. Basically a select statement that returns a table with 8 columns. I have provided 8 comma-separated variables for the 'Variable names' field, so that the results of the JDBC request can be identified with these variable names.
Created a HTTP Request Sampler that uses one of those variables ${url} in the 'Server Name or IP' field.
Though the JDBC request works flawlessly and returns a table with a bunch of rows, the problem with this is that the HTTP Request Sampler never picks up the variable from the JDBC Request result.
The HTTP Request looks like this in the 'View Results Tree':
GET http://${url}/
I have tried these solutions:
Add 'Save Responses to a File' listener to the JDBC Request. This creates a file of type '.plain' and not a CSV. Had it been a CSV, I could have utilized that CSV file by creating a CSV Data Set Config. So this attempt failed.
I have tried forcing the file name in the above attempt to always use 'C:\JMETERTest\data.csv'. But it ends up creating a new file named 'C:\JMETERTest\data.csv1.plain'. This attempt failed too.
I tried to reference the URL column as ${url_1} in the HTTP Request's Server Name field. It worked. But the problem now is that in the results tree, all the requests are going for the the URL from only the first row of the result set. I see that this is because of the row number '_1' specified in the ${url_1} above. I can use this if someone can suggest a way to parameterize the '_1' into a variable that I can loop through (probably using a 'Counter' element). I created a Counter Config Element by the Reference Name 'loopCounter'. And used this in the Server Name field of the HTTP Request:
${url_("${loopCounter}")}
But now my HTTP Requests look lamer:
GET http://${url_("${loopCounter}")}/
This did not work too.
Solution 3 looks more doable to be only if I could resolve the parameterization of the row number.
I am open to JMeter Plugin suggestions too.
I will update anything else that I try as we go on.
P.S. Please let me know if my question is not clear in anyway.
Have you tried wrapping the HTTP sampler in a ForEach controller (parent) where the variable for the controller is the URL variable obtained from the JDBC sampler?
Also, the output variable in the ForEach will be the variable you now use in the HTTP sampler.
That way it will iterate through each variable from the beginning of the index to the end and run the sampler once each time.
In 'Save responses to a File' Listener, Select Checkboxes "Don't add Suffix and Prefix". Checking these two options will ensure, you get exact Log file name.

How to Run Http Samplers in sequence order (step by step as per the ThreadGroup Order)

Behavior of my application:
HTTP Request Login
..JSON Path Extractor - Im extracting the session id
Debug Sample - Checking the session id
HTTP Request -- Im passing the session id to these requests
HTTP Request -- Im passing the session id to these requests
HTTP Request -- Im passing the session id to these requests
If I run the above script for one time Im getting the expected results above requests are passing step by step process.
If I run the above script with - Number of Threads as 5 .Then Login is hitting for 3 times other urls hitting for 2 times.
I need to run the above script one order for number of times.
I'm not seeing any regular expression extractor which you would need to pass in the session ID from one request to another. Also, if your back end uses cookies make sure to add the http cookie manager.
Here are some good JMeter getting started videos which also cover what you're trying to do:
http://blazemeter.com/blog/jmeter-tutorial-video-series

REST call status when one of the operation fails

I have a Student add REST api call. This allows candidate data as well as file attachment.
Lets say, candidate is added successfully and but the document was not uploaded for some reason.
what should be the response status code.
if both are successful, I am returning 200 with the newly created candidate JSON object.
REST API calls should be successful or fail. No half-ways.
If it's not mandatory for creation of account to upload an attachmment, it should be done in a separate call. If an attachment is mandatory (or if provided it's mandatory that it should upload), the request should fail, no user get created and then return a 4xx status code indicating the issue.
Assuming it's not mandatory, I would separate this into 2 different REST calls. Trying to overload too much functionality into one call starts making your api gets messy. I'd recommend creating one call create the user and a second to associate files to the user. Then you just use 201 (created for the new user) and 200 (for successful association of the document) response codes.
One other option: gracefully ignore the failure, create the user, return a 201 and live with the lost attachment :)