Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
So, our API is now basically finished.
And so in this final video of the section,
we're gonna quickly create documentation
for API directly in Postman.
And that's right, we can easily create
some quick documentation right in Postman.
And it's really important to have API documentation
in place because this is how we communicate to team members,
or even our final users of the API,
how they can actually use it in practice.
So let me now show you how it works.
Now before we can actually create the documentation,
let's just do some clean up here.
For example, get rid of this request, all right?
Another thing that I want to do is here in the logging in
point, we actually expose our password here.
And so that's not a good idea, and so what I'm gonna do
is to create an environment variable
which is going to hold this password.
Since it's always the same that should be no problem.
So, remember how we do that.
Well we come here to managing the environment
and so here we simply add another one.
So password, test1234.
And here this is not correct, so password, updated,
and now, let's do the same here
in the production one as well.
So password, test1234.
And so, not add, but let's close that
and so here I can now then go add and use that,
not in a string, but like this.
So password.
So let's try that.
And this gives us this weird error,
but our password is actually here so probably what
we need to do is to actually really put the quotes here.
So let's try that.
And so now indeed we're successfully logged in.
So save that now, okay?
And so now what we should do is to actually create
a description for each and every request
that we have in our collection.
Now of course I'm not going to do that,
I will just exemplify it here with the first one.
Okay?
So let's actually close these other ones
and so now here we can add a description.
And so let's just say, use this endpoint
to create a new tour.
Okay, and so again, you should now do this exact same thing
for all of your requests if your goal is to really publish
and share your API, okay?
Then the same thing applies to folders,
and to not rename, but to edit.
And so in each of these folders
we can actually also add a description.
So let's just say, something random like,
you can get all tours,
create new ones,
and edit and delete tours.
There are also special endpoints
for some special requirements.
Okay, so and again this is totally random
and I would publish something like this for my own API,
but here we really just want to test how it works, okay?
As you can see down here,
you can also use Mark down here, okay?
So for example, to make text bold,
you can think it works like this,
yeah it looks like it does,
and so yeah you can do all kinds of stuff here, okay?
You can also probably create a description
on Natours itself, so let's say,
the Natours API contains endpoints
for tours, users, and reviews.
And then again a bunch of stuff,
like you could describe your authentication process,
or your permissions and really everything the user needs
to know in order to use this API, okay?
So you should always add description
to all the requests, to all the folders
and also to, of course, the collection itself.
Oh, and we can actually describe the query parameters
in a query string, so let's do that here.
And we can also say it supports greater than,
less than equal, greater than and less than operators.
So again, just an example here
and let's save it now to the request.
And so with this I think we should be ready
to actually publish our API documentation.
And so for doing that, let's just go here
to the collections option, and then down here,
publish documentations.
And so that should then open up a browser window,
and for me it did outside of my screen
so let me just get that here.
And so now you can choose the environment.
So here we should have a list of our environments,
which for some reason we do not have, that's weird,
but anyway, we didn't want to use any environment anyway,
because that would then replace
our environment variables with their real values,
and we don't want that.
For example, we used the environment variable
on the password, so that then later
in the documentation it's not really visible, okay?
So we really want to use no environment.
Now we could also use a custom domain,
but that's only for paid users, okay?
Then we could also change all of the styling
of the API so to match it with your brand colors,
but again, that's not necessary in this case,
and so, let's actually go ahead and publish it.
And so now, this is actually public,
so everyone can view your documentation now on this URL.
Now for some reason it didn't really update all
the changes that we just did before, so that's a bit weird.
So let's actually go back to Postman
and see what's going on.
Maybe it has to do with this rotating thing here,
so I will just quit Postman and open it again.
And let's hope that fixes it.
So if we now reload here,
ahh then we get all our changes actually here.
So you see, the description that we added
for the Natours collection, okay?
Then also the description for this folder,
and the description for this request.
And finally, as the first description,
also for this parameter, okay?
Here we do then get the URL environment variable
instead of the actual URL.
Now of course, you might want to actually give
the real URL here and for that
you could simply use another environment.
So up here you can actually see all the environments
but they are private, so right now no one can use them,
but remember how in the first step,
we could have actually created this documentation
using one of the environments, and so probably we would have
used the production environment for that and so with that
we would then have the final production URL
here in our API URL's, okay?
Anyway, this is how the documentation looks like,
so here is the example request
and we can change that also to our own language.
So in this case, Node JS, but if the user is
for example doing a request using jQuery,
then they can just use jQuery, okay.
So just to see this example request here, so with Node,
it looks something like this.
So, here we have all our endpoints
and you can see that the ones that require authentication,
they actually have this lock icon here.
And so in your description you could now then add that
saying you need to log in, in order to access this endpoint,
and also how you can actually log in, okay.
Or you can also describe that here
in the authentication section, right?
So ideally, you would have descriptions for all of this.
Oh, and here I see that we actually forgot
to replace the real password but nevermind
as this is really just some example, okay?
But of course, you get all the requests
that we had in our Postman also right here.
Now another nice feature here is this run in Postman button,
and so if someone has Postman installed on their computer,
all they need to do is to click here
and then open with their Postman application.
Now I'm not going to do that right now because of course,
I already have it in my Postman, but otherwise
this is a really nice feature for the users to then go ahead
and right away start experimenting with your API.
Okay, and I think that's it actually
so this wraps up our section
and our API is now finally really completed.
So again, congratulations for making it this far
into the course, we've already covered
so much ground here together.
Now next up, there is a very, very exiting section
ahead where we will finally build
the user face for the Natours website.
So basically, we're going to use templates
to create a completely dynamic website based
on all the data that we already have in our database.
And that's really cool.
And so I can't wait to show that to you.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.