Hi everyone welcome back.
So in this video we're going to start designing a new API which will be basically handling similarity
of dicks.
Are you going to write what the objective of this API is a similarity of text so sometimes people call
this plagiarism plagiarism check.
So what does this really mean.
So if you've ever submitted like an assignment in college or something like that then usually they would
have something called a playgoer as test where they would take your assignments.
Let's say you sent an assignment right.
You wrote it and then they have a bunch of other assigned documents in assignments right gathered from
the Internet and then they would take your document and compare it to each one of these documents.
And then they would see how much of a similarity.
Like the maximum similarity.
So I say there's a document here which is very similar.
So for example 30 percent similar.
So they would tell you that hey your document or they would tell your instructor hey this document is
30 percent similar to this document over here.
And you know he should manually check it make sure that you haven't just copied stuff from here right
because that would be plagiarism.
So the API that we're going to be developing in this coming few videos is a similarity of text or a
playgoer as a test to check.
We're going to be given to X so two documents or two strings if you need to do strings 1 and 2 and then
using these two we want to compare their similarity and where we want to say okay how similar is the
first document to the second or the opposite.
How similar is the second document to the first document.
Right.
So this is basically the idea of the API that we're developing.
So in this video we're going to be looking at the chart protocol protocol chart that we usually discuss
before going into developing or designing the API.
Right.
Because we always make sure we know at least the architecture of our API.
OK.
So let's get started.
So what are our resources.
Let's first talk about resources.
Well in an API like this the first thing we want is of course to register right.
We want the ability to register a user right a new user or a new user.
This is one of our resources right there.
How can I.
Let's just do a line here.
So this is one of the resources that we should give to the user right that he would be able to register
into our API.
So that's one and then another one is to select is to detect similarity similarity off documents right
off docs.
I'm just going on right dogs.
OK.
So that's another one right here.
Give us two attacks and then you and he would see the similarity between these two.
Do the two documents right.
And then the last one is well we haven't implemented this feature in the previous API.
But if you remember Usually when a user uses one of these for example he detects the similarity of two
documents we usually take away minus one token from him.
Right.
To subtract or to simulate what would happen if he had to pay.
Right.
So we're also I mean finding an additional feature here called refill.
OK.
So basically what refill is allows the admin of this API the administrator of this API to be able to
to increase the quota of the of the tokens for one of the users right.
So let's say one of the users is called ABC.
Right.
So ABC would pay for example to the to the API owners for example $5 for 1000 tokens.
So the API owner would refill his API using 1000 tokens write extra tokens to this user.
OK.
So we're going to be implementing three three features right.
The refill.
This is the new one.
And the Detect are the new ones.
The Register we've talked about it and implemented something similar.
Now what about the you or else.
OK.
How are we going to access these resources.
Well for the Registered User we can just use Flash register and for the detecting of similarity we can
just use Flash detect and for their refill we'll as the name might suggest we just we might use refill.
Right.
Okay great.
So now we know the resources we know that you are those.
What about the method the method of transportation.
Is it a get up post a delete.
Well for the registry and you user it is post right because the user is going to be sending us his username
and password right in NJCAA.
So it's a post similar lead for detecting off similarity of documents.
It's also going to be post because the user will send us the two documents estranges right.
So if the user sends these do documents then he has to send them using post finally refill the free
fall that the administrators going to be sending How many points or how many tokens you wants to refill
and which user he wants to refill these points.
So he also has to send some information.
So this is also going to be Post OK so now let's talk about parameters.
What do we need from the user who's who's using this.
OK.
So the first one is to register a new user.
Well what are we what what might we need from the user.
Or we might need the user name that he wants and the password password.
Just right P.W. short.
OK so what about the detect OK for the detector of the similarity.
We first need to make sure that the user has the correct has enough tokens to use our service right.
So we need his username we need his password.
And we also need that to text that he wants to compare.
So we need text 1 and text do right.
We need both of these things.
And finally for their resale Well we need a couple of things we need to know which user is going to
be refilled so we get that from the user.
We also need the administrative password so-so admin password.
So what do we need the admin password.
Well if we leave this API and just open to anyone.
Well if a user runs out of tokens if he knows where a slash refill is he might just say slash freeflow
and then send his username and tokens.
1 million.
Right.
So you would essentially add 1 million tokens to his account right.
So this is you know this is not right.
He has to pay for these tokens.
So the idea here is we add an admin password which only the API owner knows.
And so if you want to add some tokens to a user it has to use the slash refill the back or slash refill
your L and he has to give the correct an industry that white only could you or only the API owner could
use this and here slash refill.
And also we need to know how many how many points.
Right so a refill amount right to a refill amount how many tokens do I need to refill to this user Okay
so finally statis good.
What are we going to return to user in different case scenarios.
Well lets start with a simple one with registration.
Well we might the user might have registered just fine.
So you might have have 200.
OK.
Right.
Is no problem here.
Another one is we might have had three 302.
So an error is if the user input an invalid username or username which already exists in the database
right.
So invalid user name right a user which already exists in our database.
So invalid username.
OK.
Another one is.
Well for now let's just leave it as that if we want to add more we can talk about it we can add it in
later videos.
OK so what about the detect all that detect has a couple of things right.
It might have 200 again.
OK.
So no problems of detected the similarity of the documents.
And I also have to return with it's a return similarity.
Right.
How similar are these two documents.
What else.
Well we also need the user might add in but a wrong user name right.
He might have input in our user name which doesn't exist in our database.
So 3 0 1 invalid username right.
This is a wrong username.
You can't use this username what else will 302.
You might have 302 which is an invalid password.
So the user inputs a user name which exists in our database but he gave the wrong password right.
So we tell him hey you input the wrong the wrong password right.
OK so what else.
Well we also have three all three right which means out of tokens.
Right.
So the user username and password are correct but he doesn't have enough tokens.
This is tokens over here.
Right.
So this is it for now.
Finally what about refills.
So Furbies we might have again 200 if everything goes smoothly and the tokens are added to this user
name.
We also have 3 0 1 right invalid username.
So that means that this user name doesn't exist.
So how are you going to try to add 100 tokens for example to a user name that doesn't exist.
So we'll have three or one invalid invalid username and then we also should have an extra one which
is three or four invalid and you might have guessed it admin password.
So what is the username is OK.
It exists.
But this password is wrong.
Then we don't.
And the point is right.
Because this might be just a hacker trying to add some token points to this user.
So we have to check that this admin password is the correct admin password.
So this is basically the API that we will be building this is the overall architecture.
And in the next video we're going to start implementing the architecture the design of it and we're
going to started from scratch.
So we're not going to use any other code snippets.
So yeah we're going to stop here.
And until the next video decoding.