create account

How to Document an API Using Postman by casweeney

View this thread on: hive.blogpeakd.comecency.com
· @casweeney · (edited)
$0.31
How to Document an API Using Postman
I was motivated to write about this because of the challenges I faced while documenting API endpoints for a mobile app I worked on as the Software (Back-end)  Engineer, the API documentations  were needed so that the company contracted to build the web version of the app will easily implement the API endpoints in their Design Screens. I won't want any engineer out there to encounter similar challenges.

The APIs I built has a lot of endpoints and I haven't documented an API before, so it was challenging for me at that time. I watched series of video tutorials, I was getting more confused because I needed to know how to properly document my API to be detailed enough for anybody you consume.

So enough with the story, let's dive in:

## Things you need to know:
- You should already know to test your API endpoints with postman.

### Step 1: Download and Install Postman
Go to [Google](https://google.com) and search for Postman
![postman.PNG](https://ipfs.busy.org/ipfs/QmdQH6XrUmywSSfRYWyfjzFSaLqrBwMax5hywGeYTg6ReM)

![postman1.PNG](https://ipfs.busy.org/ipfs/QmQUDix9w7Sd9iGLFRsjKw75QhtzHWsTxcJtj5XproRyff)

### Step 2: Sign up or Sign in on Postman
After downloading and installing postman, it will require you to sign in if you already have an account or sign up if otherwise.

### Step 3: Create a Collection
After you have signed in to post man close the  first screen that pops up:
![postman2.PNG](https://ipfs.busy.org/ipfs/QmY9Gxbp8m26ws7Rnex1hhxbUjnfCxxSx9efonUVMvoeQp)
close this popup

After closing the popup screen, you see the following screen, that is where all the magic happens
![p4.PNG](https://ipfs.busy.org/ipfs/Qme8o8gocxioN8aRk7uTmbVZuEipd2wutLKW7AsatT2gD8)

### Step 4: Create a Collection
A collection is like a way of grouping your API/Documentation to a particular action they perform. For instance I created a  collection called User - this contains endpoints and documentation that handles  everything about a user which are (registering a user, login a user into the app, login a user out).
![p5.PNG](https://ipfs.busy.org/ipfs/QmWc6LYLzbMy9pvCJfGQ2zFYTKqbsE64c6ebGd1gNXQF73)
Creating a Collection

![p6.PNG](https://ipfs.busy.org/ipfs/QmSuKFngRPXMfA95PkmTVLmJPVpcHz6BQ12BQRskEvaEXx)
Here I created a collection called **Follow** and I also gave a description of what the collection is about.

So once you have created the collection, the collection you created will be added to you list of collections.
![p7.PNG](https://ipfs.busy.org/ipfs/QmTzhdR6hgEmCjbh3QWmAcfBWpmtZyUX9sfr2kPytTXes5)
The newly created Collection has been added to the list.

### Step 5: Create your  API Request with Postman
Creating an API request is simply testing/calling your API URL(endpoint) with the appropriate parameters. The following image will explain better
![p8.PNG](https://ipfs.busy.org/ipfs/QmZj5aqCARvEFTGhhHNKSZ3nTdXJzHd5mDKmeGcVtCNmaa)
This image has parameters and values required for the endpoint to function properly(user_id with a value of 58).

### Step 6: Add description beside the parameter's value
Add a description to each parameter to enable API consumers understand the data type and the kind of values expected. See image below
![p9.PNG](https://ipfs.busy.org/ipfs/QmRDVMA2PyNRg35JwWvCL1G95rGDdJnFwmTangpCR4y3u1)
Added description to parameter - value pairs.

### Step 7: Save the request to an appropriate Collection
Now you will save your API request to the collection you created earlier. In this case you will in the Follow collection.
![p10.PNG](https://ipfs.busy.org/ipfs/QmdEFg7T9Sv7vVJkGBEDYzzDTRTrP6C2w94VjQEMXezyRE)

Use proper naming to align with endpoint function and also give proper description of what that particular endpoint does. Just like the example in the image below:
![p11.PNG](https://ipfs.busy.org/ipfs/QmbbyD5kY1vwbtzoRSQAvwJ6G5AtNi1sWYWnSaJkcmsUfe)

### Step 8: Add Example Response
This shows the  API consumers possible response they will get if successful
##### The following images will guide you :![p12.PNG](https://ipfs.busy.org/ipfs/QmcfQ85g9S8VLqtwDGeYUpzZC1F88AmkWkyC96qJvokdXL)
As you can see in this image, the endpoint has been add to the Follow Collection. Click  on example(circle with in the above image).

![p13.PNG](https://ipfs.busy.org/ipfs/QmaDFoTitbGjp4K94kK5Ui6fcLkGQYbogCy7ih2pMszTzL)
Click on add example

![p14.PNG](https://ipfs.busy.org/ipfs/QmfTHyNGpHsvHz5BPp4GempJwYKPMKWD6Hp7FMhsn68zFc)
Click on save example to save the response to the request

### Step 9: Publish the collection:
When you publish a collection, a link will be generated which you can share to possible users that will consume the API.
- The images below will guide you through the publishing  process.
![pp1.PNG](https://ipfs.busy.org/ipfs/QmRViS8Ro53zkvDYHizkfQPWC9f2nYkmx9PvNESQFTmZjn)
Click on Publish Docs: This will redirect you to your browser.

![pp2.PNG](https://ipfs.busy.org/ipfs/QmR3YUFyqkyrUarmTa19GCkwTiNYqHkW4PNRYvYWVWb4XH)
In your browser Click on the **Publish Collection** button: This will generate a shareable link for you.

![pp3.PNG](https://ipfs.busy.org/ipfs/QmdFMKSuPUxQt3u3xpGbhpFLs9oW4ckgB8J9uE1fMUCbc1)
Click on the link to view documentation or copy the link and share to API consumers.

![pp4.PNG](https://ipfs.busy.org/ipfs/QmawvL5sCRfo1XEtAUb986QePEatC5Kp6zRCGETz9aD5Vb)
This is how the documentation will look.

**Note:** You can add as many endpoints requests as possible to the published Collection.

See images of my other Published Collections with properly documented endpoints.
![user.PNG](https://ipfs.busy.org/ipfs/QmW6guBUqm72ttwRHMXQQS1FfJ26XZWSvGkCu6DxXcRB7Z)
Endpoints for Users

![settings.PNG](https://ipfs.busy.org/ipfs/QmdbGW1UMLNhnCp4hm8ScBswf65CWQ3HJoS6T7VvWgxkr1)
Endpoints for Settings

### Congratulations you can now document APIs.











👍  , , , ,
properties (23)
authorcasweeney
permlinkhow-to-document-an-api-using-postman
categorybusy
json_metadata{"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["busy","howto","tutoral","stach","nigeria"],"users":[],"links":["https://google.com"],"image":["https://ipfs.busy.org/ipfs/QmdQH6XrUmywSSfRYWyfjzFSaLqrBwMax5hywGeYTg6ReM","https://ipfs.busy.org/ipfs/QmQUDix9w7Sd9iGLFRsjKw75QhtzHWsTxcJtj5XproRyff","https://ipfs.busy.org/ipfs/QmY9Gxbp8m26ws7Rnex1hhxbUjnfCxxSx9efonUVMvoeQp","https://ipfs.busy.org/ipfs/Qme8o8gocxioN8aRk7uTmbVZuEipd2wutLKW7AsatT2gD8","https://ipfs.busy.org/ipfs/QmWc6LYLzbMy9pvCJfGQ2zFYTKqbsE64c6ebGd1gNXQF73","https://ipfs.busy.org/ipfs/QmSuKFngRPXMfA95PkmTVLmJPVpcHz6BQ12BQRskEvaEXx","https://ipfs.busy.org/ipfs/QmTzhdR6hgEmCjbh3QWmAcfBWpmtZyUX9sfr2kPytTXes5","https://ipfs.busy.org/ipfs/QmZj5aqCARvEFTGhhHNKSZ3nTdXJzHd5mDKmeGcVtCNmaa","https://ipfs.busy.org/ipfs/QmRDVMA2PyNRg35JwWvCL1G95rGDdJnFwmTangpCR4y3u1","https://ipfs.busy.org/ipfs/QmdEFg7T9Sv7vVJkGBEDYzzDTRTrP6C2w94VjQEMXezyRE","https://ipfs.busy.org/ipfs/QmbbyD5kY1vwbtzoRSQAvwJ6G5AtNi1sWYWnSaJkcmsUfe","https://ipfs.busy.org/ipfs/QmcfQ85g9S8VLqtwDGeYUpzZC1F88AmkWkyC96qJvokdXL","https://ipfs.busy.org/ipfs/QmaDFoTitbGjp4K94kK5Ui6fcLkGQYbogCy7ih2pMszTzL","https://ipfs.busy.org/ipfs/QmfTHyNGpHsvHz5BPp4GempJwYKPMKWD6Hp7FMhsn68zFc","https://ipfs.busy.org/ipfs/QmRViS8Ro53zkvDYHizkfQPWC9f2nYkmx9PvNESQFTmZjn","https://ipfs.busy.org/ipfs/QmR3YUFyqkyrUarmTa19GCkwTiNYqHkW4PNRYvYWVWb4XH","https://ipfs.busy.org/ipfs/QmdFMKSuPUxQt3u3xpGbhpFLs9oW4ckgB8J9uE1fMUCbc1","https://ipfs.busy.org/ipfs/QmawvL5sCRfo1XEtAUb986QePEatC5Kp6zRCGETz9aD5Vb","https://ipfs.busy.org/ipfs/QmW6guBUqm72ttwRHMXQQS1FfJ26XZWSvGkCu6DxXcRB7Z","https://ipfs.busy.org/ipfs/QmdbGW1UMLNhnCp4hm8ScBswf65CWQ3HJoS6T7VvWgxkr1"]}
created2019-09-20 11:44:24
last_update2019-09-20 16:24:09
depth0
children1
last_payout2019-09-27 11:44:24
cashout_time1969-12-31 23:59:59
total_payout_value0.145 HBD
curator_payout_value0.161 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,767
author_reputation4,383,456,648,005
root_title"How to Document an API Using Postman"
beneficiaries
0.
accountbusy.org
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,759,814
net_rshares1,351,576,183,176
author_curate_reward""
vote details (5)
@steemitboard ·
Congratulations @casweeney! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@casweeney/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@casweeney) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=casweeney)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-casweeney-20191130t005226000z
categorybusy
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-11-30 00:52:27
last_update2019-11-30 00:52:27
depth1
children0
last_payout2019-12-07 00:52:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length624
author_reputation38,975,615,169,260
root_title"How to Document an API Using Postman"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,949,007
net_rshares0