What’s an API?

API stands for Application Programming Interface. Many third-party companies provide access to their specialist services via a published API. You can offer that service to your clients within the applications you create.

Some third party API’s include

  • Postcode address file lookup
  • electronic document signing
  • E-commerce payment gateways
  • integration with popular accounts software
  • local weather and news
  • latitude and longitude lookup
  • realtime currency exchange rates
  • Share prices
  • find job vacancies
  • time zone conversion

You can also publish your own API to gain benefits of

  • code sharing between apps based on differing runtime platforms
  • preventing apps from directly accessing the database to ensure database can be updated without updating all apps
  • offloading processing to multiple servers and microservices

Many of the API’s in use today are REST (REpresentational State Transfer) API’s. These provide a dedicated public URL for each callable function together with standard documentation on usage often automatically created.

Swagger UI
Swagger documentation and test form

API responses are often returned in JSON (Javascript Object Notation) a javascript based structured data format readable in any language.

JSON
JSON data response

To call an API you identify the Http verb via the documentation

  • GET, retrieve data
  • POST, submit data for a NEW record
  • PUT, update an existing record
  • DELETE, delete an existing record

To access most API’s require you authenticate to the API. Methods that might be available include

  • OAuth2
  • JWT (JSON Web Tokens)
  • Api Key

Testing an API

Postman is a great app for initially testing an API before any code is created. It includes support for numerous authentication methods. More details can be found here.