Let's talk about tooling and testing an API !
GUI Tools and their limits
Like most developers I guess, I often use GUI tools like Fiddl...
For further actions, you may consider blocking this person and/or reporting abuse
Although I liked the tool for easily writing requests against the server, I should disagree with the fact that it does testing, you just perform a request and get a response from the server.
Is there any way to actually do non-manual testing with it, short of generating the code snippet for it and pasting it inside a test?
Yes you are right. I was not talking about automated testing or something like that. I was only talking to manually test your API. I use it mainly for hitting a breakpoint in my API and debug my code.
I am not aware of a way of doing automated testing with that but if you found something I would be glad to hear about it.
How do you add a parameter in the url?
Do you mean like that ? Or something else ?
I mean if you're working on a crud operations and you need to pass a parameter
In my example you can just change the value of the planetName variable. You can also do not use local variable and set environment variable in your vs code settings (rest-client.environmentVariables)
Just came across your article and it was really helpful. But I still don't understand how to pass parameters in POST request
I have written an example in a response to a comment above.
You can do something like the following. Here I am defining a variable @test with a value of HELLO and using this parameter in my POST request.
@test is your parameter, you just have to change its value to pass a different value in your request.
I have been using REST Client for a long time and never knew that we can use variables and we can also pass values from previous results. Thanks for sharing.
As I understood this is only for VS Code what about alternative in Visual Studio ?
I don't know an alternative for Visual Studio but I would say you don't really need to. You can do your usual development in Visual Studio and have VS code opened to do other things like querying your API.
There is one alternative for Visual Studio now called Rest Client (for Visual Studio). It's an extension as well
Insomnia also allows for assigning variables for each environment, really helps with having to update a whole set of requests or when an auth token is required.
The one thing postman does that is nice is the auto generation of documentation, but if you're using .net back end you can do that too with swagger UI.
Can the variables be used inside POST data? I have added an item in a request. I can get the id from the response. Then I want to use the id in a different POST request. It doesn't seem to work:-(
Yes you can, you just have to call the first request, then the second request.
You can find below an example. I tested it, it works fine.
1) Is there anyway I can hit the multiple endpoints
2) Is there anyway to put some assertions
1) What do you mean by multiple endpoints ? You can use variables to change the environment / url you are targetting.
2) I don't know about that but I don't think so.