DEV Community

Discussion on: Testing your API with REST Client

 
techwatching profile image
Alexandre Nédélec

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.

### Second request using a variable 
@test = HELLO
POST https://jsonplaceholder.typicode.com/posts
Content-Type: application/json

{
    "userId": 1,
    "title": "TEST ",
    "body": "TEST body {{test}}"
}
Enter fullscreen mode Exit fullscreen mode