How to call PUT method in Fiddler - wcf

I created a PUT WCF service to update my database. How do I call this service in fiddler to test if it working properly.
I did try the URL in Fiddler and it gave me 404!
Anyone help me with this?

In the request builder there is a drop down. By default it shows "GET" and it allows you to select the HTTP method that you wish to use. Change this to "PUT" and you should be done.
You might also want to take a look at this...
Doing a HTTP PUT from a browser
... and investigate the use of the X-HTTP-Method-Override header.
You should also read this...
Use Fiddler to Test RESTful WCF Services
http://www.keyvan.ms/use-fiddler-to-test-restful-wcf-services

Related

Difference between REST Client and browser

I wonder what is the difference between REST Client like Postman and browser? I want to make API calls but I dont understand why I have to use a REST Client instead of a browser.
A browser permits to create simple GET calls, you invoke a url and obtain the response.
A REST Client permits more possibilities like:
to construct every type of REST/HTTP call such as POST,PUT and DELETE,
add headers to the calls,
build a body for the calls (a json/xml or whatever of want one).
It's a tool more sophisticated.
You can install a standalone one like:
Postman
Insomnia
or install a browser extension for Firefox and Chrome like:
Resting
Rester
Disclaimer: I'm the creator and maintainer of Resting

Can Cypress intercept requests being made directly to a server?

I have been trying to intercept a server request using Cypress' intercept method.
I have noticed that Cypress can intercept requests made through the front-end/browser, however, the intercept method doesn't work if I make a request directly to the back-end server.
Let me clarify what I mean:
One thing is intercepting a request that the front-end/browser makes to the back-end server.
Another thing is intercepting a call that doesn't use the browser but calls directly the back-end endpoint.
For example:
I can create a user using the front-end interface
or I can create a user calling the back-end endpoint directly (directly calling the server).
Coming back to my question. Is there a way to intercept a call that was made directly to the back-end endpoint?
This is what I have tried so far:
I wrote a regex to intercept api/v0/customers
I then made a request to http://locahost:5440/api/v0/customers (which is the URL of the server)
Finally, I waited for the request to happen
Timeout request using Cypress intercept method
cy.intercept(/^\/api\/v0\/customers\/$/).as('createCustomer');
cy.request(createCustomer(customerData, headers));
cy.wait('#createCustomer').then(({ status, body }) => {
const customerId = body.customer_id;
console.log(body);
expect(status).equal(201);
});
Here's the problem: There was a timeout error.
As you can see in the image, I'm making a request to http://locahost:5440 which is the server URL. NOTE: I made sure the server was up and running.
The regex is also correct and it will match the endpoint http://locahost:5440/api/v0/customers
I suspect that intercept only works for requests being made through the browser. Is this assertion correct? I couldn't find this answer anywhere in the Cypress docs.
Is there a way for me to intercept a call being made directly to a server (not using the browser)?
You don't have to intercept the requests you explicitly make with cypress, just use .then to get the response, like this:
cy.request(createCustomer(customerData, headers)).then((response) => {
const customerId = response.body.customer_id;
console.log(response.body);
expect(response.status).equal(201);
});
Reference: https://docs.cypress.io/api/commands/request#Yields

Api object in Genexus returns Method Not Allowed

can anyone help me?
It is my first time creating an API Object in Genexus. I've already yaml archive:
I need to test in Postman but I received this error:
If you a re using IIS try this:
How To change the IIS configuration to use PUT and DELETE in API object:
You change the verbs in the IIS configuration, in the "Extensionless-URLHandling-Integrated" you double click, you go to Restrictions / Verbs and you have to add PUT and DELETE (or select ALL verbs)
You have to change it at the Server level (Default Web site)
The problem seems to be that your endpoint doesn't support "post" request. In the image I only see a "get" declaration...so you have to change POST to GET on your Postman.
Thanks for your answers, the API object was defined as GET, that was wrong, so I made it POST and now it is working.

How to Login in Web Application using REST APIs through JMETER

I am trying a Performance scenario where single user logs in to web application.
For that i am using Jmeter and REST-APIs
Here i have to call REST-APIs for that i have used "HTTP Request Defaults", I have created one thread group and added one "HTTP Request Default".
From APIs i have to pass two parameters:
1) User Name
2) Password
What would be the syntax of parameters in HTTP Request Defaults? or what sampler i should use for this?
I have one API link from which we can trigger those parameter, which will get applied on web application.
First of all you'll need a HTTP Header Manager configured to send the following header:
Name: Content-Type
Value: application/json
Elsewise your request may not be processed as needed
The sampler you need to use is generic HTTP Request sampler. The easiest way to provide JSON payload is to switch to Body Data tab and put your JSON there as below:
Optionally you may with to use JSON Path Extractor for correlation
See Testing SOAP/REST Web Services Using JMeter guide for a quick ramp-up on the RESTful web services testing domain.
for ease of use
In your Jmeter click on File, select Templates
In the opened window/dialog, select "Building a SOAP web-service test plan"
Click on Create.
It will open a test plan, which should give you a fare idea on how to achieve your scenario.
Hope this will help.

Change the request_method from GET to POST

I need to transform a HTTP Request from a GET method to a POST methode in Apache.
Is it possible ?
I'm working with Dailymotion. This service send a GET method to my REST API to post some data. But I would like to receive a POST method to respect REST protocol.
I'm trying to make this transformation with Apache.
Thanks a lot.