REST CLIENT in Visual Studio Code Complete Guide || Alternative Postman

This guide goes over setting up and learn REST Client (in vscode) that allows us to send HTTP request and view the response in Visual Studio Code directly.



Step: 1


  • Open your visual studio code.
  • Next click on the EXTENSION option
  • After that click on the SEARCH bar and write down REST Client
  • Finally press the INSTALL button. 

    Step: 2
    • Create a new rest file as like api.rest
    • Next copy and paste the following standard RFC 2616 that including request method, headers, and body on your api.rest file

      POST https://example.com/comments HTTP/1.1
      content-type: application/json

      {
      "name": "sample",
      "time": "Wed, 21 Oct 2015 18:27:50 GMT"
      }


      Real-time demo:



      Step: 3

    • click on the Send Request



      Step: 4

    • Finally you will get your data, as like


    { "user": { "role": 0, "history": [], "_id": "60fd8b320052a4753b89f37d", "name": "jack", "email": "jack@gmail.com", "salt": "c7c773c0-ed61-11eb-af6b-1d83679cff83", "hashed_password": "d7da6de70822bf1a693a6d52c3dfe16962c948cd", "createdAt": "2021-07-25T16:02:58.457Z", "updatedAt": "2021-07-25T16:02:58.457Z", "__v": 0 } }

    Real-Time demo Screen short in the below:

    Step: 5
    • If you need to Send Request , write down again this code with new data, and you will get new "user"

      POST http://localhost:8000/api/signup HTTP/1.1
      content-type: application/json

      {
      "name": "jackson",
      "email": "jackson@gmail.com",
      "password": "jackson007"
      }


    Bravo ! You have successfully done this


Comments

Popular Posts