Why do you need to register to use an API?

Question

Many API services, including the one utilized in this lesson, require registration to use them. Why do you need to register to use an API?

Answer

There are several reasons that some API services require registration to utilize.

One important reason is that it adds a level of security to the service. By linking API requests to some account, if there is any malicious use of the service, then it can trace it back to that account. Also, without requiring registration, there can be many anonymous users that can abuse the system or service without a way to trace back to some specific account.

Another reason that an API service might require registration is that the service stores information per user, so in order for a user to keep their data, they must have an account that it can connect to. For example, Rebrandly, which is used in this lesson, stores your shortened URL’s, so that you can add, remove, or edit the ones that you have created.

One other reason registration is required for some API services is that the service may have a limit on the amount of requests that can be made over a period of time. This is sometimes due to load on the servers, because each API request to the server costs energy and time. With registration, it becomes easier to set this limit per user account.

10 Likes

then why didnt we register API for GET requests?

Because we were “getting” information from the datamuse API, now we need to “post” information to a custom API.

5 Likes

So what is the role of apikey in post requests?

That’s only for authentication

yeah this is kind of a :-1: :-1: :-1: :-1: probably going to sign up and use it once…, for this exercise and never again. Like why? what’s the difference between this and https://bitly.com that does it with no registration??? Hmmmm thanks sponsored exercise.

6 Likes

You don’t have to.
Just put any phony string as apiKey and you’re still able to finish the course. Use a bit of imagination for the intended output.

4 Likes

First to admit… i just used a disposable email and got the api info out… though i’m sure my actual email has been bought and sold thousands of times by now… But what do we say to the gods of spam? Not today.

3 Likes

Hi there, my understanding is as follows:
Whether a registration is necessary or not depends on the API, not on the type of the request (GET vs. POST).
For the GET request exercises we used the datamuse API, which apparently doesn’t require a registration. For the POST request exercise we’re using the Rebrandly API, which apparently requires a registration.

3 Likes