Coder Social home page Coder Social logo

api-postman-practice's Introduction

API-Postman-Practice

As an addition to the blog post I wrote about using the json-server node module, which enables you to make HTTP requests in seconds. I wanted to also get you going with a few practice requests that you can use within Postman.

Using the Collection

I'm actually trying something new, you can share a collection from your Postman client and add a "Run in Postman" button to a site, it's the first time that i'm giving it a go so let me know if it doesn't work.

Run in Postman

Alternatively, you can just grab the collection .json file from this repo and manually import this on your machine. It's up to you :)

Although this collection is solely aimed at requesting and posting data using the dummyUsers.json file, the same requests can be used with any data file that you create. You will just need to amend the requests as per your routes/endpoints.

Just to get you started

Once you have the Json Server collection imported into Postman, you should be able to see the various requests (GETs, POSTs, PUTs and DELETEs) contained within the folder.

Start the server in the directory that you have the dummyUsers.json file, using the following command in your terminal:

> node json-server dummyUsers.json

Add the --watch flag to use live-reload on the file or the -p flag to change the port number, if required.

Using the POST Create a New User request from the collection, inspect the data in the Body tab. The request body should look like this:

{
 "id":99,
 "first_name":"Joe",
 "last_name":"User",
 "email":"[email protected]",
 "gender":"Male",
 "ip_address":"999.999.999.999"
}

If you're happy with the data, press Send on the UI or hit Ctrl+Enter to create the new user. You can use the GET All Users request to see the new user, as well as the all the other users with the json file.

So that's just a basic collection to get you started, explore with making new requests or start to intergate some of the json-server features:

As always, let me know if you have an questions!! Enjoy!

api-postman-practice's People

Contributors

dannydainton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.