-: The next part of the URL
and this is the first optional part of the URL
is the ID parameter.
Now, what is it actually the ID parameter?
So when the URL deals with a specific entity
then the next part is the ID
of the entity that we are dealing with.
Now, what do we mean by dealing with a specific entity?
Well, there are some examples that we'll see later
but the most simple one is
that we want to get a specific entity.
Not to perform a search in the database
for a range of entities,
but we actually want the server to bring us back
a very specific entity which has a unique idea.
And this is where the ID will come in the URL.
So the ID is really part
of the URL and it'll look something like this.
So here we have the api, the version, the entity
and the ID.
So when exactly are we going to use this id?
So the main use of the ID as we mentioned earlier
is with GET when we want to retrieve a specific entity.
But it is also used with PUT
remember that PUT is used to update an entity.
So when we are updating an entity
we need to specify which entity we want to update.
And for this, we will use the ID parameter.
In addition ID parameter often used with the delete
because when we need to delete a specific entity, we
will specify the entity using the ID parameter in the URL.
Now what you won't see in this list is the post
because when adding a new entity, there is no ID for it.
The ID will be usually set by the database.
And when adding the entity, we still do not have its ID.
Okay, so now let's add the ID to our URL.
So here we are again in Receptor
and all we need to do is simply add forward slash and an ID.
In this case, I will use number 17.
So we have a URL
with the API version entity, and ID.