Songtham Tung

WTF Are APIs?

If you’re a working professional, you’ve probably heard your coworkers talk about APIsWeb Services, endpoints, and other weird words like 200 and 401. What the heck does it mean and what’s the difference between them?

What‘s an API?

An API, or application program interface, is something that enables different apps to communicate with each other. A Web Service is a type of API that communicates over the internet.
Generally, when apps communicate with each other, there is an exchange of request and response.
  • Request is asking for something
  • Response is the answer to a request
    App A sends request to App B. App B sends response back to App A.
    Similar to requesting for something in real life, you may not get the response that you would like or expect. Sometimes you’re successful, and sometimes you’re not.
    An example of this would be Googling something. When you type something in the search engine and press enter, it performs an API request. Most of the time, Google returns a response back with millions of results, but sometimes it’s not able to find anything.
    As we will see in the following section, there are specific phrases that modern day techies use when they talk about APIs. Now you too, can be in the know!

    Requests

    • “Make / Fire an API call”: make a request.
    • “Make a GET request”: make a request to get data.
    • “Make a POST request”: make a request to create data.
    • “Make a PUT request”: make a request to update data.
    • “Endpoint”: the url e.g. (https://twitter.com/songthamtung).
    • “Hit the endpoint”: perform a request at the specified url.

    Response

    • “200”: The HTTP response code for Success.
    • “301”: The HTTP response code for Redirect.
    • “400”: The HTTP response code for Bad Request.
    • 401”: The HTTP response code for Unauthorized.
    • “403": The HTTP response code for Forbidden.
    • “404”: The HTTP response code for Not Found.
    • “500”: The HTTP response code for Internal Server Error.
    • “504”: The HTTP response code for Timeout.

    Authentication

    • “OAUTH”: a way for apps to grant permission with the use of tokens.
    • “Token”: a form of authentication, similar to username/password.
    • “Refresh the token”: tokens can and do expire. If you’re getting a 401, consider refreshing your API token.

    General

    • “Do they have an API?”: does their app have a way for our app to communicate with?
    • “Open API”: available for public use.
    • “Closed API”: not available for public use.
    • “API limit”: some APIs have a limit on how many requests you can make within a certain period e.g. (1000 requests per day).
    • CRUD”: Create, Read, Update, and Delete.
    • “Test it with Postman”Postman is an awesome API development tool.
    • “Header”: explains the type of data being sent.
    • “Body”: the data being sent.
    • “GUID”: Globally Unique Identifier that is used for distinctive records e.g. (e20f5d52–5490–4523–87c5-af46dadfe7c1).
    • “JSON”: a type of data format characterized by {"key":"value"}
    • “XML”: a type of data format characterized by <tag>value</tag>
    • “REST(ful) API”: a type of API that uses REpresentational State Transfer constraints.
    • “SOAP API”: a type of API that uses Simple Object Access Protocol and is XML-based.
    • “GraphQL”: a query language for APIs.
    • “Check their documentation”: most APIs have a reference page about getting started, authentication, and methods that it supports.

    Conclusion

    Tech people love using technical words. This is not done to confuse or exclude outsiders, but rather, to quickly and effectively communicate ideas, problems, and solutions.
    As with any languages, you can combine words to form meaningful sentences:
    “Yes! The API response returned a 200!”
    “Try creating a new user. Hit the user endpoint and make a POST request”
    Hopefully you are now able to understand the two sentences above. The vernacular of those in the tech field can seem daunting at first, but with time and practice, it will start to become second nature.
    If you have another way of communicating about APIs or you have any questions with examples above, just drop a comment below to let me know.
    Thanks for reading! Originally posted on A Cloud Guru.

Tags

Comments

More by Songtham Tung

Topics of interest